More instcombine cleanup, towards improving debug line info.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131604 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eli Friedman
2011-05-18 23:58:37 +00:00
parent e0b58634a1
commit e6f364b6c4
4 changed files with 14 additions and 12 deletions
@@ -57,12 +57,14 @@ Instruction *InstCombiner::visitAllocaInst(AllocaInst &AI) {
Value *Idx[2];
Idx[0] = NullIdx;
Idx[1] = NullIdx;
Value *V = GetElementPtrInst::CreateInBounds(New, Idx, Idx + 2,
New->getName()+".sub", It);
Instruction *GEP =
GetElementPtrInst::CreateInBounds(New, Idx, Idx + 2,
New->getName()+".sub");
InsertNewInstBefore(GEP, *It);
// Now make everything use the getelementptr instead of the original
// allocation.
return ReplaceInstUsesWith(AI, V);
return ReplaceInstUsesWith(AI, GEP);
} else if (isa<UndefValue>(AI.getArraySize())) {
return ReplaceInstUsesWith(AI, Constant::getNullValue(AI.getType()));
}