[llvm] [BOLT] Allow getNewFunctionOrDataAddress to map addrs inside functions (PR #117766)

Amir Ayupov via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 27 14:14:35 PST 2024


================
@@ -5569,14 +5569,10 @@ uint64_t RewriteInstance::getNewFunctionOrDataAddress(uint64_t OldAddress) {
   if (const BinaryFunction *BF =
           BC->getBinaryFunctionContainingAddress(OldAddress)) {
     if (BF->isEmitted()) {
-      // If OldAddress is the another entry point of
-      // the function, then BOLT could get the new address.
-      if (BF->isMultiEntry()) {
-        for (const BinaryBasicBlock &BB : *BF)
-          if (BB.isEntryPoint() &&
-              (BF->getAddress() + BB.getOffset()) == OldAddress)
-            return BF->getOutputAddress() + BB.getOffset();
-      }
+      for (const BinaryBasicBlock &BB : *BF)
+        if ((BF->getAddress() + BB.getOffset()) == OldAddress)
+          return BB.getOutputStartAddress();
----------------
aaupov wrote:

As Maksim has pointed out on Discord, we may not have the mapping set unless LongJmp pass is enabled, or addresses are tracked with address map.

https://github.com/llvm/llvm-project/pull/117766


More information about the llvm-commits mailing list