Use MachineFunction::iterator instead of a MachineBasicBlock* because
FallThrough maybe == to MF.end().
llvm-svn: 15372
diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp
index 980852e..b510375 100644
--- a/llvm/lib/CodeGen/BranchFolding.cpp
+++ b/llvm/lib/CodeGen/BranchFolding.cpp
@@ -172,8 +172,9 @@
MachineInstr *UncondBr = MI;
MachineFunction::iterator FallThrough = MBB; ++FallThrough;
- MachineBasicBlock *UncondDest = MI->getOperand(0).getMachineBasicBlock();
- if (UncondDest == &*FallThrough) {
+ MachineFunction::iterator UncondDest =
+ MI->getOperand(0).getMachineBasicBlock();
+ if (UncondDest == FallThrough) {
// Just delete the branch. This does not effect the CFG.
MBB->erase(UncondBr);
return true;