[llvm-branch-commits] [llvm-branch] r268132 - Merging r267634:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Apr 29 16:15:39 PDT 2016


Author: hans
Date: Fri Apr 29 18:15:39 2016
New Revision: 268132

URL: http://llvm.org/viewvc/llvm-project?rev=268132&view=rev
Log:
Merging r267634:
------------------------------------------------------------------------
r267634 | qcolombet | 2016-04-26 16:44:14 -0700 (Tue, 26 Apr 2016) | 11 lines

[X86] Make sure it is safe to clobber EFLAGS, if need be, when choosing
the prologue.

Do not use basic blocks that have EFLAGS live-in as prologue if we need
to realign the stack. Realigning the stack uses AND instruction and this
clobbers EFLAGS.

An other alternative would have been to save and restore EFLAGS around
the stack realignment code, but this is likely inefficient.

Fixes PR27531.
------------------------------------------------------------------------

Added:
    llvm/branches/release_38/test/CodeGen/X86/i686-win-shrink-wrapping.ll
      - copied unchanged from r267634, llvm/trunk/test/CodeGen/X86/i686-win-shrink-wrapping.ll
Modified:
    llvm/branches/release_38/   (props changed)
    llvm/branches/release_38/lib/Target/X86/X86FrameLowering.cpp
    llvm/branches/release_38/lib/Target/X86/X86FrameLowering.h

Propchange: llvm/branches/release_38/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Apr 29 18:15:39 2016
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,257645,257648,257730,257775,257791,257864,257875,257886,257902,257905,257925,257929-257930,257940,257942,257977,257979,257997,258103,258112,258168,258184,258207,258221,258273,258325,258406,258416,258428,258436,258471,258609-258611,258616,258690,258729,258891,258971,259177-259178,259228,259236,259342,259346,259375,259381,259645,259649,259695-259696,259702,259740,259798,259835,259840,259886,259888,259958,260164,260390,260427,260587,260641,260703,260733,261033,261039,261258,261306,261360,261365,261368,261384,261387,261441,261447,261546,264335
+/llvm/trunk:155241,257645,257648,257730,257775,257791,257864,257875,257886,257902,257905,257925,257929-257930,257940,257942,257977,257979,257997,258103,258112,258168,258184,258207,258221,258273,258325,258406,258416,258428,258436,258471,258609-258611,258616,258690,258729,258891,258971,259177-259178,259228,259236,259342,259346,259375,259381,259645,259649,259695-259696,259702,259740,259798,259835,259840,259886,259888,259958,260164,260390,260427,260587,260641,260703,260733,261033,261039,261258,261306,261360,261365,261368,261384,261387,261441,261447,261546,264335,267634

Modified: llvm/branches/release_38/lib/Target/X86/X86FrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_38/lib/Target/X86/X86FrameLowering.cpp?rev=268132&r1=268131&r2=268132&view=diff
==============================================================================
--- llvm/branches/release_38/lib/Target/X86/X86FrameLowering.cpp (original)
+++ llvm/branches/release_38/lib/Target/X86/X86FrameLowering.cpp Fri Apr 29 18:15:39 2016
@@ -2569,6 +2569,12 @@ eliminateCallFramePseudoInstr(MachineFun
   }
 }
 
+bool X86FrameLowering::canUseAsPrologue(const MachineBasicBlock &MBB) const {
+  assert(MBB.getParent() && "Block is not attached to a function!");
+  const MachineFunction &MF = *MBB.getParent();
+  return !TRI->needsStackRealignment(MF) || !MBB.isLiveIn(X86::EFLAGS);
+}
+
 bool X86FrameLowering::canUseAsEpilogue(const MachineBasicBlock &MBB) const {
   assert(MBB.getParent() && "Block is not attached to a function!");
 

Modified: llvm/branches/release_38/lib/Target/X86/X86FrameLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_38/lib/Target/X86/X86FrameLowering.h?rev=268132&r1=268131&r2=268132&view=diff
==============================================================================
--- llvm/branches/release_38/lib/Target/X86/X86FrameLowering.h (original)
+++ llvm/branches/release_38/lib/Target/X86/X86FrameLowering.h Fri Apr 29 18:15:39 2016
@@ -127,6 +127,16 @@ public:
   /// Check that LEA can be used on SP in an epilogue sequence for \p MF.
   bool canUseLEAForSPInEpilogue(const MachineFunction &MF) const;
 
+  /// Check whether or not the given \p MBB can be used as a prologue
+  /// for the target.
+  /// The prologue will be inserted first in this basic block.
+  /// This method is used by the shrink-wrapping pass to decide if
+  /// \p MBB will be correctly handled by the target.
+  /// As soon as the target enable shrink-wrapping without overriding
+  /// this method, we assume that each basic block is a valid
+  /// prologue.
+  bool canUseAsPrologue(const MachineBasicBlock &MBB) const override;
+
   /// Check whether or not the given \p MBB can be used as a epilogue
   /// for the target.
   /// The epilogue will be inserted before the first terminator of that block.




More information about the llvm-branch-commits mailing list