llvm.org GIT mirror llvm / f775f95
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) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9109 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 16 years ago
1 changed file(s) with 5 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
174174
175175 for (BasicBlock::iterator I = LastBlock->begin(), E = LastBlock->end();
176176 I != E; )
177 if (AllocaInst *AI = dyn_cast(I)) {
178 ++I; // Move to the next instruction
179 LastBlock->getInstList().remove(AI);
180 Caller->front().getInstList().insert(InsertPoint, AI);
181 } else {
182 ++I;
183 }
177 if (AllocaInst *AI = dyn_cast(I++))
178 if (isa(AI->getArraySize())) {
179 LastBlock->getInstList().remove(AI);
180 Caller->front().getInstList().insert(InsertPoint, AI);
181 }
184182 }
185183
186184 // If we just inlined a call due to an invoke instruction, scan the inlined