[llvm-commits] [llvm] r125552 - /llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp
Evan Cheng
evan.cheng at apple.com
Mon Feb 14 21:00:24 PST 2011
Author: evancheng
Date: Mon Feb 14 23:00:24 2011
New Revision: 125552
URL: http://llvm.org/viewvc/llvm-project?rev=125552&view=rev
Log:
Fix thinko. Cmp can be the first instruction in a MBB.
Modified:
llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp
Modified: llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp?rev=125552&r1=125551&r2=125552&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp (original)
+++ llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp Mon Feb 14 23:00:24 2011
@@ -331,7 +331,8 @@
ImmDefRegs.clear();
ImmDefMIs.clear();
- MachineBasicBlock::iterator PMII = I->begin();
+ bool First = true;
+ MachineBasicBlock::iterator PMII;
for (MachineBasicBlock::iterator
MII = I->begin(), MIE = I->end(); MII != MIE; ) {
MachineInstr *MI = &*MII;
@@ -348,7 +349,7 @@
if (OptimizeCmpInstr(MI, MBB)) {
// MI is deleted.
Changed = true;
- MII = llvm::next(PMII);
+ MII = First ? I->begin() : llvm::next(PMII);
continue;
}
}
@@ -360,6 +361,8 @@
if (SeenMoveImm)
Changed |= FoldImmediate(MI, MBB, ImmDefRegs, ImmDefMIs);
}
+
+ First = false;
PMII = MII;
++MII;
}
More information about the llvm-commits
mailing list