Skip to content

Commit e71e653

Browse files
committed
x86: check hasOpaqueSPAdjustment in canRealignStack
Summary: @rnk pointed out in [1] that x86's canRealignStack logic should match that in CantUseSP from hasBasePointer. [1]: http://reviews.llvm.org/D11160?id=29713#inline-89350 Reviewers: rnk Subscribers: rnk, llvm-commits Differential Revision: http://reviews.llvm.org/D11377 llvm-svn: 243772
1 parent 698e8cf commit e71e653

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

llvm/lib/Target/X86/X86RegisterInfo.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,10 @@ void X86RegisterInfo::adjustStackMapLiveOutMask(uint32_t *Mask) const {
433433
// Stack Frame Processing methods
434434
//===----------------------------------------------------------------------===//
435435

436+
static bool CantUseSP(const MachineFrameInfo *MFI) {
437+
return MFI->hasVarSizedObjects() || MFI->hasOpaqueSPAdjustment();
438+
}
439+
436440
bool X86RegisterInfo::hasBasePointer(const MachineFunction &MF) const {
437441
const MachineFrameInfo *MFI = MF.getFrameInfo();
438442

@@ -445,9 +449,7 @@ bool X86RegisterInfo::hasBasePointer(const MachineFunction &MF) const {
445449
// reference locals while also adjusting the stack pointer. When we can't
446450
// use both the SP and the FP, we need a separate base pointer register.
447451
bool CantUseFP = needsStackRealignment(MF);
448-
bool CantUseSP =
449-
MFI->hasVarSizedObjects() || MFI->hasOpaqueSPAdjustment();
450-
return CantUseFP && CantUseSP;
452+
return CantUseFP && CantUseSP(MFI);
451453
}
452454

453455
bool X86RegisterInfo::canRealignStack(const MachineFunction &MF) const {
@@ -464,7 +466,7 @@ bool X86RegisterInfo::canRealignStack(const MachineFunction &MF) const {
464466

465467
// If a base pointer is necessary. Check that it isn't too late to reserve
466468
// it.
467-
if (MFI->hasVarSizedObjects())
469+
if (CantUseSP(MFI))
468470
return MRI->canReserveReg(BasePtr);
469471
return true;
470472
}

0 commit comments

Comments
 (0)