Skip to content

[Docs] Document persistent metadata printing - #220967

Merged
yxsamliu merged 5 commits into
llvm:mainfrom
yxsamliu:amd/dev/yaxunl/PR-220390-persistent-metadata-release-note-main
Sep 8, 2026
Merged

[Docs] Document persistent metadata printing#220967
yxsamliu merged 5 commits into
llvm:mainfrom
yxsamliu:amd/dev/yaxunl/PR-220390-persistent-metadata-release-note-main

Conversation

@yxsamliu

@yxsamliu yxsamliu commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Document how persistent metadata IDs affect intermediate and standalone
textual output. Final assembly output remains canonically renumbered.

Follow-up to #220390.

Document how persistent metadata IDs affect intermediate and standalone
textual output. Final assembly output remains canonically renumbered.

Follow-up to llvm#220390.

@zmodem zmodem left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I don't have a lot of context on this, so may question might be naive, as may future readers :)

Comment thread llvm/docs/ReleaseNotes.md Outdated
@zmodem

zmodem commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

In the Rust tests I was looking at, the order did change though.

In the first test I was looking at (https://github.com/rust-lang/rust/blob/main/tests/codegen-llvm/async-fn-debug-awaitee-field.rs) it seemed that !DINamespace and !DICompositeType nodes were getting reordered.

If that's not expected, that seems like something that should be fixed.

@yxsamliu

yxsamliu commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, you’re right. Rust calls Module::print() directly, which does not renumber the metadata first, so the numbering and definition order can change. I updated the release note to clarify this and explain how clients can request canonical numbering.

@zmodem

zmodem commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Interesting!

But I'm still confused, probably because I don't have enough context, but the readers of this release note won't have it either. It sounds like there are now "persistent" and "canonical" metadata node numbers -- the "persistent" ones are new, and the "canonical" ones should match what we had before.

But what is the motivation for having two numberings? Should Rust also do the renumbering before printing, or just update its expectations to match the new numbering?

@yxsamliu

yxsamliu commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

@zmodem Re: metadata numbering

Persistent IDs make pass dumps easier to compare: unchanged metadata keeps the same number as passes modify the module. Canonical numbering uses consecutive numbers with no gaps, in a consistent order, making final IR easier to read.

For Rust’s final IR output, I’d call Module::renumberMetadataForAssembly() before Module::print(), as LLVM’s final-output paths do. Tests of intermediate dumps may need updated expectations.

I’ll clarify the motivation and this recommendation in the release note.

The release note names two numbering modes without explaining why
clients should choose one over the other.

Explain how persistent IDs help compare intermediate dumps, and how
consecutive canonical IDs make final IR easier to read. Recommend
renumbering before final output for clients that call Module::print()
directly.
The release note explains how stable metadata IDs help compare output,
but leaves out the printing speedup that motivated the change.

Explain that reusing IDs avoids repeated scans of the whole module and
can significantly speed up debug and pass printing on large modules.

@zmodem zmodem left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks!

@yxsamliu
yxsamliu merged commit c4babfb into llvm:main Sep 8, 2026
13 checks passed
vadimkotov pushed a commit to vadimkotov/llvm-project that referenced this pull request Sep 8, 2026
Document how persistent metadata IDs affect intermediate and standalone
textual output. Final assembly output remains canonically renumbered.

Follow-up to llvm#220390.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants