mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
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
This commit is contained in:
parent
e7394ea9c6
commit
326d976eb2
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user