[llvm] [AArch64] Fix miscompilation due to integer overflow in immediate offset for stack store/load instructions with preserve_all (PR #207026)
Nathan Corbyn via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 9 01:41:05 PDT 2026
================
@@ -1794,27 +1794,34 @@ void computeCalleeSaveRegisterPairs(const AArch64FrameLowering &AFL,
bool NeedsWinCFI = AFL.needsWinCFI(MF);
int Scale = TRI->getSpillSize(*RPI.RC);
+ // True when the pair's ldp/stp offset fits the signed 7-bit scaled imm.
+ auto PairFitsImmRange = [&]() {
+ int Aligned = AlignOffset(ByteOffset, Scale);
+ int PairOffset = IsWindows ? Aligned : Aligned + StackFillDir * 2 * Scale;
+ int Scaled = PairOffset / Scale;
+ return Scaled >= -64 && Scaled <= 63;
+ };
----------------
cofibrant wrote:
I'm confused by the use of a closure here. Why not just compute directly?
https://github.com/llvm/llvm-project/pull/207026
More information about the llvm-commits
mailing list