This is an archive of the discontinued LLVM Phabricator instance.

[BOLT] Prevent adding secondary entry points for BB labels
ClosedPublic

Authored by jobnoorman on Aug 31 2023, 7:33 AM.

Details

Summary

When linker relaxation is enabled on RISC-V, every branch has a relocation and a
corresponding symbol in the symbol table. BOLT currently registers all these
symbols as secondary entry points causing almost every function to be marked as
multi entry on RISC-V.

This patch modifies adjustFunctionBoundaries to ignore these symbols.
Note that I currently try to detect them by checking if a symbol's name
starts with the private label prefix as defined by MCAsmInfo. Since
I'm not entirely sure what multi-entry functions look like on different
targets, please check if this condition is correct. Maybe it could make
sense to only check this on RISC-V?

Diff Detail

Event Timeline

jobnoorman created this revision.Aug 31 2023, 7:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 31 2023, 7:33 AM
jobnoorman requested review of this revision.Aug 31 2023, 7:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 31 2023, 7:33 AM
maksfb accepted this revision.Sep 11 2023, 2:48 PM
maksfb added inline comments.
bolt/lib/Rewrite/RewriteInstance.cpp
1592–1593

It makes sense to run this check for other platforms as well, like it's written. In that case, remove "[RISCV]" from the title. Just to be safe, add a check that the prefix is not empty.

This revision is now accepted and ready to land.Sep 11 2023, 2:48 PM
jobnoorman retitled this revision from [BOLT][RISCV] Prevent adding secondary entry points for BB labels to [BOLT] Prevent adding secondary entry points for BB labels.
jobnoorman edited the summary of this revision. (Show Details)
  • Check that prefix is not empty
  • Remove [RISCV] from title