[llvm] [BOLT] a local out-of-range stub might lead to infinite loop in LongJmp (PR #73918)

Vladislav Khmelevsky via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 4 22:24:58 PST 2023


================
@@ -202,10 +202,20 @@ LongJmpPass::replaceTargetWithStub(BinaryBasicBlock &BB, MCInst &Inst,
     }
   } else if (LocalStubsIter != Stubs.end() &&
              LocalStubsIter->second.count(TgtBB)) {
-    // If we are replacing a local stub (because it is now out of range),
-    // use its target instead of creating a stub to jump to another stub
+    // The TgtBB and TgtSym now are the local out-of-range stub and its label.
+    // So, we are attempting to restore BB to its previous state without using
+    // this stub.
     TgtSym = BC.MIB->getTargetSymbol(*TgtBB->begin());
-    TgtBB = BB.getSuccessor(TgtSym, BI);
+    auto *TgtBBSucc = TgtBB->getSuccessor(TgtSym, BI);
----------------
yota9 wrote:

Also replace auto with BinaryBasicBlock please, we prefer not to use auto.

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


More information about the llvm-commits mailing list