aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/InlineFunction.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-09-13 19:23:57 +0000
committerChris Lattner <sabre@nondot.org>2006-09-13 19:23:57 +0000
commit33bb3c8be355d179ece8e751f6e0f0978d0dd038 (patch)
tree1559b1422e65d090bbfdcaf3370e5626133a8e77 /lib/Transforms/Utils/InlineFunction.cpp
parent54ae241ed4c986e59ba4e1d6ac0e1ce6d66b0a71 (diff)
Implement the first half of Transforms/Inline/inline_cleanup.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30303 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/InlineFunction.cpp')
-rw-r--r--lib/Transforms/Utils/InlineFunction.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp
index 7b97646c19..b61a85be9d 100644
--- a/lib/Transforms/Utils/InlineFunction.cpp
+++ b/lib/Transforms/Utils/InlineFunction.cpp
@@ -245,7 +245,14 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG) {
BasicBlock::iterator InsertPoint = Caller->begin()->begin();
for (BasicBlock::iterator I = FirstNewBlock->begin(),
E = FirstNewBlock->end(); I != E; )
- if (AllocaInst *AI = dyn_cast<AllocaInst>(I++))
+ if (AllocaInst *AI = dyn_cast<AllocaInst>(I++)) {
+ // If the alloca is now dead, remove it. This often occurs due to code
+ // specialization.
+ if (AI->use_empty()) {
+ AI->eraseFromParent();
+ continue;
+ }
+
if (isa<Constant>(AI->getArraySize())) {
// Scan for the block of allocas that we can move over, and move them
// all at once.
@@ -260,6 +267,7 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG) {
FirstNewBlock->getInstList(),
AI, I);
}
+ }
}
// If the inlined code contained dynamic alloca instructions, wrap the inlined