[llvm] [BOLT][AArch64] Partial support for lite mode (PR #133014)

Maksim Panchenko via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 27 12:12:27 PDT 2025


================
@@ -1673,12 +1678,104 @@ bool BinaryFunction::scanExternalRefs() {
     if (BranchTargetSymbol) {
       BC.MIB->replaceBranchTarget(Instruction, BranchTargetSymbol,
                                   Emitter.LocalCtx.get());
-    } else if (!llvm::any_of(Instruction,
-                             [](const MCOperand &Op) { return Op.isExpr(); })) {
-      // Skip assembly if the instruction may not have any symbolic operands.
-      continue;
     } else {
+      bool NeedsPatch = false;
       analyzeInstructionForFuncReference(Instruction);
+      for (unsigned OpNum = 0; OpNum < MCPlus::getNumPrimeOperands(Instruction);
+           ++OpNum) {
+        const MCSymbol *Symbol = BC.MIB->getTargetSymbol(Instruction, OpNum);
+        if (!Symbol)
+          continue;
+        if (!ignoreReference(Symbol)) {
+          NeedsPatch = true;
+          break;
+        }
+      }
----------------
maksfb wrote:

Good idea.

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


More information about the llvm-commits mailing list