[llvm] r254480 - [X86] Fix a think-o when checking if the eflags needs to be preserved.

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 1 18:07:01 PST 2015


Author: qcolombet
Date: Tue Dec  1 20:07:00 2015
New Revision: 254480

URL: http://llvm.org/viewvc/llvm-project?rev=254480&view=rev
Log:
[X86] Fix a think-o when checking if the eflags needs to be preserved.

Modified:
    llvm/trunk/lib/Target/X86/X86FrameLowering.cpp

Modified: llvm/trunk/lib/Target/X86/X86FrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FrameLowering.cpp?rev=254480&r1=254479&r2=254480&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86FrameLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FrameLowering.cpp Tue Dec  1 20:07:00 2015
@@ -211,6 +211,7 @@ static bool isEAXLiveIn(MachineFunction
 static bool
 flagsNeedToBePreservedBeforeTheTerminators(const MachineBasicBlock &MBB) {
   for (const MachineInstr &MI : MBB.terminators()) {
+    bool BreakNext = false;
     for (const MachineOperand &MO : MI.operands()) {
       if (!MO.isReg())
         continue;
@@ -224,8 +225,13 @@ flagsNeedToBePreservedBeforeTheTerminato
       if (!MO.isDef())
         return true;
       // This terminator defines the eflags, i.e., we don't need to preserve it.
-      return false;
+      // However, we still need to check this specific terminator does not
+      // read a live-in value.
+      BreakNext = true;
     }
+    // We found a definition of the eflags, no need to preserve them.
+    if (BreakNext)
+      return false;
   }
 
   // None of the terminators use or define the eflags.




More information about the llvm-commits mailing list