X86RegisterInfo: eliminateFrameIndex: Force SP for AfterFPPop; NFC
authorMatthias Braun <matze@braunis.de>
Thu, 20 Apr 2017 23:34:46 +0000 (23:34 +0000)
committerMatthias Braun <matze@braunis.de>
Thu, 20 Apr 2017 23:34:46 +0000 (23:34 +0000)
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

llvm/lib/Target/X86/X86RegisterInfo.cpp

index 9bab9a4..b368385 100644 (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);