[llvm] [IR] Avoid collecting COMDATs for non-module printing (PR #221460)
Yaxun Liu via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 16 14:53:22 PDT 2026
yxsamliu wrote:
Yes. I profiled the current head with Callgrind on the same `medium.ll`
workload. I preassembled it to bitcode and disabled verification so input
parsing did not dominate the profile.
About 69% of Callgrind's CPU instruction count is in CFG printing. The main
remaining costs are building and escaping DOT node labels and normal
instruction printing. The `AssemblyWriter` constructor itself is only about
0.27% now, so I do not see another large constructor cost like the COMDAT scan.
The next possible follow-ups are repeated module slot processing, about 6.5%,
and metadata kind-name lookup, about 3.7%. Avoiding those would need shared or
cached state, so they do not look as small or clearly safe as this change. I
think they are better investigated separately. These are inclusive shares, so
the percentages overlap.
https://github.com/llvm/llvm-project/pull/221460
More information about the llvm-commits
mailing list