mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
Fix a memory bug: increment an iterator of a deleted machine instr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48853 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -200,7 +200,8 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) {
|
||||
for (MachineFunction::iterator mbbi = MF.begin(), mbbe = MF.end();
|
||||
mbbi != mbbe; ++mbbi) {
|
||||
for (MachineBasicBlock::iterator mi = mbbi->begin(), me = mbbi->end();
|
||||
mi != me; ++mi) {
|
||||
mi != me; ) {
|
||||
MachineBasicBlock::iterator nmi = next(mi);
|
||||
const TargetInstrDesc &TID = mi->getDesc();
|
||||
|
||||
bool FirstTied = true;
|
||||
@ -298,7 +299,10 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) {
|
||||
// then one instruction.
|
||||
Sunk = Sink3AddrInstruction(mbbi, New, regB, mi);
|
||||
mbbi->erase(mi); // Nuke the old inst.
|
||||
if (!Sunk) mi = New;
|
||||
if (!Sunk) {
|
||||
mi = New;
|
||||
nmi = next(mi);
|
||||
}
|
||||
++NumConvertedTo3Addr;
|
||||
// Done with this instruction.
|
||||
break;
|
||||
@ -337,6 +341,7 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) {
|
||||
|
||||
DOUT << "\t\trewrite to:\t"; DEBUG(mi->print(*cerr.stream(), &TM));
|
||||
}
|
||||
mi = nmi;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user