This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Emit Verbose Asm when using --lto-emit-asm
ClosedPublic

Authored by Pierre-vh on Jan 9 2023, 2:34 AM.

Details

Summary

D138560 was abandonned as the use case can already be covered by -Xoffload-linker --lto-emit-asm.
However the output from --lto-emit-asm doesn't have
comments like the Clang -S output.

This patch adds verbose assembly output to LLD ELF LTO
so that the resulting assembly file more closely matches Clang's.

Having comments is especially important on targets such as AMDGPU because
they contain additional information about the kernel(s) being compiled.

Diff Detail

Event Timeline

Pierre-vh created this revision.Jan 9 2023, 2:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 9 2023, 2:34 AM
Pierre-vh requested review of this revision.Jan 9 2023, 2:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 9 2023, 2:34 AM

[ELF] tag is more common for lld/ELF changes. lto-emit-asm => --lto-emit-asm (drop quotes in the subject).

lld/test/ELF/lto/emit-asm.ll
14
16

You can drop -DAG for all CHECK lines. I don't think they make tests more maintainable.

Pierre-vh retitled this revision from [LLD] Emit Verbose Asm when using `lto-emit-asm` to [ELF] Emit Verbose Asm when using --lto-emit-asm.Jan 11 2023, 12:08 AM
Pierre-vh marked 2 inline comments as done.

Rebase, update test docs

lld/test/ELF/lto/emit-asm.ll
16

There's cat %t2.s %t2.s1 | FileCheck %s above f2 comes before f1 for that one (f2 is in %t2.s), so if I remove -DAG the test fails.
I'm not sure how lto-partitions=2 works. Is f2 always in %t2.s and f1 always in %t2.s1? If yes I think we can swap the arguments to cat & remove -DAG

MaskRay accepted this revision.Jan 11 2023, 10:21 AM
MaskRay added inline comments.
lld/test/ELF/lto/emit-asm.ll
14
This revision is now accepted and ready to land.Jan 11 2023, 10:21 AM
Pierre-vh marked an inline comment as done.

Address comment

This revision was landed with ongoing or failed builds.Jan 11 2023, 11:58 PM
This revision was automatically updated to reflect the committed changes.