Fix a bug in the code which re-inserts DBG_VALUE nodes after scheduling;

if a block is split (by a custom inserter), the insert point may be in a
different block than it was originally. This fixes 32-bit llvm-gcc
bootstrap builds, and I haven't been able to reproduce it otherwise.

llvm-svn: 108060
This commit is contained in:
Dan Gohman 2010-07-10 22:42:31 +00:00
parent 79be2b9be5
commit a64a323564
1 changed files with 3 additions and 1 deletions

View File

@ -642,8 +642,10 @@ MachineBasicBlock *ScheduleDAGSDNodes::EmitSchedule() {
// Insert to start of the BB (after PHIs).
BB->insert(BBBegin, DbgMI);
else {
// Insert at the instruction, which may be in a different
// block, if the block was split by a custom inserter.
MachineBasicBlock::iterator Pos = MI;
BB->insert(llvm::next(Pos), DbgMI);
MI->getParent()->insert(llvm::next(Pos), DbgMI);
}
}
}