[PATCH] D113613: [ThinLTO][MC] Use conditional assignments for promotion aliases

Sami Tolvanen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 10 14:12:35 PST 2021


samitolvanen created this revision.
Herald added subscribers: ormris, jeroen.dobbelaere, steven_wu, hiraditya, inglorion, emaste.
samitolvanen requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.

Inline assembly refererences to static functions with ThinLTO+CFI were
fixed in D104058 <https://reviews.llvm.org/D104058> by creating aliases for promoted functions. Creating
the aliases unconditionally resulted in an unexpected size increase in
a Chrome helper binary:

https://bugs.chromium.org/p/chromium/issues/detail?id=1261715

This is caused by the compiler being unable to drop unused code now
referenced by the alias in module-level inline assembly. This change
adds a .set_conditional assembly extension, which emits an assignment
only if the target symbol is also emitted, avoiding phantom references
to functions that could have otherwise been dropped.

This is an alternative to the solution proposed in D112761 <https://reviews.llvm.org/D112761>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113613

Files:
  llvm/include/llvm/MC/MCStreamer.h
  llvm/lib/MC/MCParser/AsmParser.cpp
  llvm/lib/MC/MCStreamer.cpp
  llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
  llvm/test/MC/ELF/set-conditional.s
  llvm/test/ThinLTO/X86/devirt2.ll
  llvm/test/Transforms/ThinLTOBitcodeWriter/cfi-icall-static-inline-asm.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113613.386315.patch
Type: text/x-patch
Size: 9410 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211110/fe3f88f7/attachment.bin>


More information about the llvm-commits mailing list