From: Quentin Colombet Date: Wed, 2 Dec 2015 02:07:00 +0000 (+0000) Subject: [X86] Fix a think-o when checking if the eflags needs to be preserved. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=653cbb792b87ae54ee7fdd2477411f450791f27b;p=oota-llvm.git [X86] Fix a think-o when checking if the eflags needs to be preserved. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254480 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/X86/X86FrameLowering.cpp b/lib/Target/X86/X86FrameLowering.cpp index cc8bbd09f50..52cf9fd44cb 100644 --- a/lib/Target/X86/X86FrameLowering.cpp +++ b/lib/Target/X86/X86FrameLowering.cpp @@ -211,6 +211,7 @@ static bool isEAXLiveIn(MachineFunction &MF) { 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 @@ flagsNeedToBePreservedBeforeTheTerminators(const MachineBasicBlock &MBB) { 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.