diff options
author | Evan Cheng <evan.cheng@apple.com> | 2011-02-15 05:00:24 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2011-02-15 05:00:24 +0000 |
commit | 326d976eb2b03d1f2b7537d7b90dff264fd84378 (patch) | |
tree | a000a4c77ff0a07d0c4088122948c886b5f4976b /lib/CodeGen/PeepholeOptimizer.cpp | |
parent | e7394ea9c6fac7e1af3a1e4b24fc545d8898110f (diff) |
Fix thinko. Cmp can be the first instruction in a MBB.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125552 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/PeepholeOptimizer.cpp')
-rw-r--r-- | lib/CodeGen/PeepholeOptimizer.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/CodeGen/PeepholeOptimizer.cpp b/lib/CodeGen/PeepholeOptimizer.cpp index 3474f755b8..5d7123caa0 100644 --- a/lib/CodeGen/PeepholeOptimizer.cpp +++ b/lib/CodeGen/PeepholeOptimizer.cpp @@ -331,7 +331,8 @@ bool PeepholeOptimizer::runOnMachineFunction(MachineFunction &MF) { 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 @@ bool PeepholeOptimizer::runOnMachineFunction(MachineFunction &MF) { 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 @@ bool PeepholeOptimizer::runOnMachineFunction(MachineFunction &MF) { if (SeenMoveImm) Changed |= FoldImmediate(MI, MBB, ImmDefRegs, ImmDefMIs); } + + First = false; PMII = MII; ++MII; } |