[llvm] [ARM][ConstantIslands] Correct MinNoSplitDisp calculation (PR #114590)

via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 11 12:31:27 PST 2024


================
@@ -1324,7 +1324,8 @@ bool ARMConstantIslands::findAvailableWater(CPUser &U, unsigned UserOffset,
   MachineBasicBlock *UserBB = U.MI->getParent();
   BBInfoVector &BBInfo = BBUtils->getBBInfo();
   const Align CPEAlign = getCPEAlign(U.CPEMI);
-  unsigned MinNoSplitDisp = BBInfo[UserBB->getNumber()].postOffset(CPEAlign);
+  unsigned MinNoSplitDisp =
+      BBInfo[UserBB->getNumber()].postOffset(CPEAlign) - UserOffset;
   if (CloserWater && MinNoSplitDisp > U.getMaxDisp() / 2)
     return false;
----------------
pzhengqc wrote:

I also have the same doubt actually. The check `MinNoSplitDisp > U.getMaxDisp() / 2` is only relevant when `CloserWater` is true which means the pass has not converged after 15 iterations with the default `arm-constant-island-max-iteration` being 30. I guess the original intention was that, given that the pass has not converged with this many iterations (in practice, it rarely seems to take more than 3 iterations to converge), maybe it should change its strategy to be more aggressive now (therefore comparing against `U.getMaxDisp() / 2` instead of `U.getMaxDisp()`)?

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


More information about the llvm-commits mailing list