[llvm] [ARM][ConstantIslands] Correct MinNoSplitDisp calculation (PR #114590)
Simon Tatham via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 6 07:15: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;
----------------
statham-arm wrote:
I understand that this change means that `MinNoSplitDisp` is now the exact offset between the user of the constant-pool entry and the place we're considering putting the entry itself. But why are we then splitting the block if that's more than _half_ of `U.getMaxDisp()`? I would expect that if the distance we have to reach is actually _larger_ than `U.getMaxDisp()`, that's when we need to split something.
But I don't understand why the previous code was comparing against `U.getMaxDisp() / 2` either. Do you?
https://github.com/llvm/llvm-project/pull/114590
More information about the llvm-commits
mailing list