[llvm] r243772 - x86: check hasOpaqueSPAdjustment in canRealignStack
JF Bastien
jfb at google.com
Fri Jul 31 11:28:09 PDT 2015
Author: jfb
Date: Fri Jul 31 13:28:09 2015
New Revision: 243772
URL: http://llvm.org/viewvc/llvm-project?rev=243772&view=rev
Log:
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
Modified:
llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=243772&r1=243771&r2=243772&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Fri Jul 31 13:28:09 2015
@@ -433,6 +433,10 @@ void X86RegisterInfo::adjustStackMapLive
// Stack Frame Processing methods
//===----------------------------------------------------------------------===//
+static bool CantUseSP(const MachineFrameInfo *MFI) {
+ return MFI->hasVarSizedObjects() || MFI->hasOpaqueSPAdjustment();
+}
+
bool X86RegisterInfo::hasBasePointer(const MachineFunction &MF) const {
const MachineFrameInfo *MFI = MF.getFrameInfo();
@@ -445,9 +449,7 @@ bool X86RegisterInfo::hasBasePointer(con
// reference locals while also adjusting the stack pointer. When we can't
// use both the SP and the FP, we need a separate base pointer register.
bool CantUseFP = needsStackRealignment(MF);
- bool CantUseSP =
- MFI->hasVarSizedObjects() || MFI->hasOpaqueSPAdjustment();
- return CantUseFP && CantUseSP;
+ return CantUseFP && CantUseSP(MFI);
}
bool X86RegisterInfo::canRealignStack(const MachineFunction &MF) const {
@@ -464,7 +466,7 @@ bool X86RegisterInfo::canRealignStack(co
// If a base pointer is necessary. Check that it isn't too late to reserve
// it.
- if (MFI->hasVarSizedObjects())
+ if (CantUseSP(MFI))
return MRI->canReserveReg(BasePtr);
return true;
}
More information about the llvm-commits
mailing list