[llvm] [BOLT][AArch64] Reduce the number of ADR relaxations (PR #111577)

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 12:56:41 PDT 2024


================
@@ -56,13 +56,14 @@ void ADRRelaxationPass::runOnFunction(BinaryFunction &BF) {
           continue;
       }
 
-      // Don't relax adr if it points to the same function and it is not split
-      // and BF initial size is < 1MB.
+      // Don't relax ADR if it points to the same function and is in the main
+      // fragment and BF initial size is < 1MB.
       const unsigned OneMB = 0x100000;
       if (BF.getSize() < OneMB) {
         BinaryFunction *TargetBF = BC.getFunctionForSymbol(Symbol);
-        if (TargetBF == &BF && !BF.isSplit())
+        if (TargetBF == &BF && !BB.isSplit())
----------------
dcci wrote:

This looks fine to me. Can we add a negative test? (e.g. one where the func is not in the main fragment to show the adrp is still there?)

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


More information about the llvm-commits mailing list