summaryrefslogtreecommitdiff
path: root/llvm/lib/Target/X86/X86CmovConversion.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/X86/X86CmovConversion.cpp')
-rw-r--r--llvm/lib/Target/X86/X86CmovConversion.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/lib/Target/X86/X86CmovConversion.cpp b/llvm/lib/Target/X86/X86CmovConversion.cpp
index 05349a7c01f8..863438793acf 100644
--- a/llvm/lib/Target/X86/X86CmovConversion.cpp
+++ b/llvm/lib/Target/X86/X86CmovConversion.cpp
@@ -582,10 +582,9 @@ static bool checkEFLAGSLive(MachineInstr *MI) {
}
// We hit the end of the block, check whether EFLAGS is live into a successor.
- for (auto I = BB->succ_begin(), E = BB->succ_end(); I != E; ++I) {
- if ((*I)->isLiveIn(X86::EFLAGS))
+ for (MachineBasicBlock *Succ : BB->successors())
+ if (Succ->isLiveIn(X86::EFLAGS))
return true;
- }
return false;
}
@@ -797,8 +796,7 @@ void X86CmovConverterPass::convertCmovInstsToBranches(
MOp.setIsKill(false);
}
}
- MBB->erase(MachineBasicBlock::iterator(MI),
- std::next(MachineBasicBlock::iterator(MI)));
+ MBB->erase(&MI);
// Add this PHI to the rewrite table.
FalseBBRegRewriteTable[NewCMOV->getOperand(0).getReg()] = TmpReg;