Skip to content

Commit 1fab93b

Browse files
committed
Fixups
1 parent 59fca0a commit 1fab93b

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

llvm/lib/Target/AArch64/AArch64FrameLowering.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3171,12 +3171,15 @@ static void computeCalleeSaveRegisterPairs(
31713171
if (RPI.isPaired())
31723172
return IsWindows ? RPI.Reg1 == AArch64::FP && RPI.Reg2 == AArch64::LR
31733173
: RPI.Reg1 == AArch64::LR && RPI.Reg2 == AArch64::FP;
3174-
// -aarch64-stack-hazard-size=<val> disables register pairing, so look
3175-
// for the frame record as two unpaired registers.
3176-
if (AFI->hasStackHazardSlotIndex())
3177-
return i > 0 && RPI.Reg1 == AArch64::FP &&
3178-
CSI[i - 1].getReg() == AArch64::LR;
3179-
return false;
3174+
// Otherwise, look for the frame record as two unpaired registers. This is
3175+
// needed for -aarch64-stack-hazard-size=<val>, which disables register
3176+
// pairing (as the padding may be too large for the LDP/STP offset). Note:
3177+
// On Windows, this check works out as current reg == FP, next reg == LR,
3178+
// and on other platforms current reg == FP, previous reg == LR. This
3179+
// works out as the correct pre-increment or post-increment offsets
3180+
// respectively.
3181+
return i > 0 && RPI.Reg1 == AArch64::FP &&
3182+
CSI[i - 1].getReg() == AArch64::LR;
31803183
};
31813184

31823185
// Save the offset to frame record so that the FP register can point to the

0 commit comments

Comments
 (0)