[BOLT] Don't register internal func relocs as external references
authorJob Noorman <jnoorman@igalia.com>
Thu, 22 Jun 2023 07:33:32 +0000 (09:33 +0200)
committerJob Noorman <jnoorman@igalia.com>
Thu, 22 Jun 2023 07:35:54 +0000 (09:35 +0200)
commit38ba2824c85606e0e7bb2071055d0c7aceb463c1
tree8b85f51a3616aa789b5e8518d7ab97e7beb9f4d9
parentb410d24a194482bbf06aed8956083fabd52d6069
[BOLT] Don't register internal func relocs as external references

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.

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D153345
bolt/lib/Rewrite/RewriteInstance.cpp