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

llvm-svn: 254480
This commit is contained in:
Quentin Colombet 2015-12-02 02:07:00 +00:00
parent a11bdc8ef7
commit bbdebefff6
1 changed files with 7 additions and 1 deletions

View File

@ -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.