[PATCH] D32205: X86RegisterInfo: eliminateFrameIndex: Force SP in AfterFPPop case; NFC

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 18 17:29:51 PDT 2017


MatzeB created this revision.
Herald added a subscriber: mcrosier.

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.


Repository:
  rL LLVM

https://reviews.llvm.org/D32205

Files:
  lib/Target/X86/X86RegisterInfo.cpp


Index: lib/Target/X86/X86RegisterInfo.cpp
===================================================================
--- lib/Target/X86/X86RegisterInfo.cpp
+++ lib/Target/X86/X86RegisterInfo.cpp
@@ -675,12 +675,14 @@
   bool AfterFPPop = Opc == X86::TAILJMPm64 || Opc == X86::TAILJMPm ||
                     Opc == X86::TCRETURNmi || Opc == X86::TCRETURNmi64;
 
-  if (hasBasePointer(MF))
+  if (AfterFPPop) {
+    assert(!hasBasePointer(MF));
+    assert(!needsStackRealignment(MF));
+    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);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32205.95662.patch
Type: text/x-patch
Size: 810 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170419/327584a7/attachment.bin>


More information about the llvm-commits mailing list