[llvm] [BOLT] Support computed goto and allow map addrs inside functions (PR #120267)

Ash Dobrescu via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 7 06:48:46 PST 2025


================
@@ -5596,10 +5611,16 @@ uint64_t RewriteInstance::getNewFunctionOrDataAddress(uint64_t OldAddress) {
       // 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->forEachEntryPoint(
+                  [&](uint64_t Offset, const MCSymbol *Symbol) {
+                    if (BB.isEntryPoint() &&
+                        (BF->getAddress() + BB.getOffset()) == OldAddress)
+                      return true;
+                    return false;
+                  }))
+            return BB.getOutputStartAddress();
+        }
----------------
Rin18 wrote:

No worries, I have now reverted this change.

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


More information about the llvm-commits mailing list