X86RegisterInfo: eliminateFrameIndex: Force SP for AfterFPPop; NFC

AfterFPPop is used for tailcall/tailjump instructions. We shouldn't ever
have frame-pointer/base-pointer relative addressing for those. After all
the frame/base pointer should already be restored to their previous
values at the return.

Make this fact explicit in preparation for an upcoming refactoring.

Differential Revision: https://reviews.llvm.org/D32205

llvm-svn: 300922
This commit is contained in:
Matthias Braun 2017-04-20 23:34:46 +00:00
parent 8048b44a8c
commit 63e3e8ce72
1 changed files with 4 additions and 3 deletions

View File

@ -675,12 +675,13 @@ X86RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
bool AfterFPPop = Opc == X86::TAILJMPm64 || Opc == X86::TAILJMPm ||
Opc == X86::TCRETURNmi || Opc == X86::TCRETURNmi64;
if (hasBasePointer(MF))
if (AfterFPPop) {
assert(FrameIndex < 0 && "Should only reference fixed stack objects here");
BasePtr = StackPtr;
} else if (hasBasePointer(MF))
BasePtr = (FrameIndex < 0 ? FramePtr : getBaseRegister());
else if (needsStackRealignment(MF))
BasePtr = (FrameIndex < 0 ? FramePtr : StackPtr);
else if (AfterFPPop)
BasePtr = StackPtr;
else
BasePtr = (TFI->hasFP(MF) ? FramePtr : StackPtr);