[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 09:19:06 PDT 2026
================
@@ -2647,11 +2649,23 @@ void AArch64FrameLowering::determineCalleeSaves(MachineFunction &MF,
auto SpillSize = TRI->getSpillSize(*RC);
bool IsZPR = AArch64::ZPRRegClass.contains(Reg);
bool IsPPR = !IsZPR && AArch64::PPRRegClass.contains(Reg);
+
+ // A register and its super-register can both appear in SavedRegs (e.g. for
+ // preserve_all, AAPCS contributes D8-D15 while the extended convention
+ // contributes the enclosing Q8-Q31). Only the widest register is actually
+ // spilled, skip such sub-registers here to avoid double-counting the
+ // overlap.
----------------
cofibrant wrote:
I think it would be fine to land the double counting fix first? It would reduce the surface area of this patch and should be separately testable.
https://github.com/llvm/llvm-project/pull/207026
More information about the llvm-commits
mailing list