diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2011-05-18 23:58:37 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2011-05-18 23:58:37 +0000 |
commit | e6f364b6c44eda14cd4ad54366ea5cc7246b9500 (patch) | |
tree | 706d91514e105f506b5fdf97aee80798078f2397 /lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp | |
parent | e0b58634a1953ed9138882da8b251b3e2aab9220 (diff) | |
download | external_llvm-e6f364b6c44eda14cd4ad54366ea5cc7246b9500.zip external_llvm-e6f364b6c44eda14cd4ad54366ea5cc7246b9500.tar.gz external_llvm-e6f364b6c44eda14cd4ad54366ea5cc7246b9500.tar.bz2 |
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
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp index 432adc9..cf52962 100644 --- a/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp +++ b/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp @@ -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())); } |