Do not move variable sized allocations to the top of the caller, which might

break dominance relationships, and is otherwise bad.  This fixes bug:
Inline/2003-10-13-AllocaDominanceProblem.ll.  This also fixes miscompilation
of 3 176.gcc source files (reload1.c, global.c, flow.c)

llvm-svn: 9109
This commit is contained in:
Chris Lattner 2003-10-14 01:11:07 +00:00
parent 84b5eb206c
commit b4778c73c9
1 changed files with 5 additions and 7 deletions

View File

@ -175,13 +175,11 @@ bool InlineFunction(CallSite CS) {
for (BasicBlock::iterator I = LastBlock->begin(), E = LastBlock->end();
I != E; )
if (AllocaInst *AI = dyn_cast<AllocaInst>(I)) {
++I; // Move to the next instruction
LastBlock->getInstList().remove(AI);
Caller->front().getInstList().insert(InsertPoint, AI);
} else {
++I;
}
if (AllocaInst *AI = dyn_cast<AllocaInst>(I++))
if (isa<Constant>(AI->getArraySize())) {
LastBlock->getInstList().remove(AI);
Caller->front().getInstList().insert(InsertPoint, AI);
}
}
// If we just inlined a call due to an invoke instruction, scan the inlined