Fix problem in DEBUG code. I could be pointing past the end and

dereferencing it causes an assertion error.

llvm-svn: 11458
This commit is contained in:
Alkis Evlogimenos 2004-02-15 00:46:41 +00:00
parent d5eec5ebcf
commit 636e19d4b1
1 changed files with 14 additions and 14 deletions

View File

@ -245,20 +245,20 @@ bool FPS::processBasicBlock(MachineFunction &MF, MachineBasicBlock &BB) {
}
// Print out all of the instructions expanded to if -debug
DEBUG(if (&*I == PrevMI) {
std::cerr<< "Just deleted pseudo instruction\n";
} else {
MachineBasicBlock::iterator Start = I;
// Rewind to first instruction newly inserted.
while (Start != BB.begin() &&
--Start != MachineBasicBlock::iterator(PrevMI));
++Start;
std::cerr << "Inserted instructions:\n\t";
Start->print(std::cerr, MF.getTarget());
while (++Start != I); ++Start;
}
dumpStack();
);
DEBUG(
MachineBasicBlock::iterator PrevI(PrevMI);
if (I == PrevI) {
std::cerr<< "Just deleted pseudo instruction\n";
} else {
MachineBasicBlock::iterator Start = I;
// Rewind to first instruction newly inserted.
while (Start != BB.begin() && prior(Start) != PrevI) --Start;
std::cerr << "Inserted instructions:\n\t";
Start->print(std::cerr, MF.getTarget());
while (++Start != next(I));
}
dumpStack();
);
Changed = true;
}