This is an archive of the discontinued LLVM Phabricator instance.

[BOLT] Don't register internal func relocs as external references
ClosedPublic

Authored by jobnoorman on Jun 20 2023, 6:56 AM.

Details

Summary

Currently, all relocations that point inside a function are registered
as external references. If these relocations cannot be resolved as jump
tables or computed gotos, the containing function gets marked as
not-simple and excluded from optimizations.

RISC-V uses relocations for branches and jumps (to support linker
relaxation) and as such, almost no functions get marked as simple. This
patch fixes this by only registering relocations that originate outside
of the referenced function as external references.

Note that this patch causes many functions in existing RISC-V test cases
to be considered "simple" and undergo transformations. This triggered
some missing MCPlusBuilder interfaces. Therefore, this patch by itself
breaks many tests. The missing interfaces are implemented by the parents
of this patch.

Depends on D153342, D153343 and D153344

Diff Detail

Event Timeline

jobnoorman created this revision.Jun 20 2023, 6:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 20 2023, 6:56 AM
jobnoorman requested review of this revision.Jun 20 2023, 6:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 20 2023, 6:56 AM
This revision is now accepted and ready to land.Jun 21 2023, 1:19 PM