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)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9109
91177308-0d34-0410-b5e6-
96231b3b80d8
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