summaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-01-23 17:19:42 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-01-23 17:19:42 +0000
commit35b78fd04c4b1e2a0b648a2d5d0463cfa8f4c0ce (patch)
tree118156f3bfd080edcd31be4d0b5fdd50bb92e226 /lib/Transforms/IPO
parent7d3b9d96b6405c1a0b6d1ae73d5a4a1d506d500d (diff)
downloadllvm-35b78fd04c4b1e2a0b648a2d5d0463cfa8f4c0ce.tar.gz
llvm-35b78fd04c4b1e2a0b648a2d5d0463cfa8f4c0ce.tar.bz2
llvm-35b78fd04c4b1e2a0b648a2d5d0463cfa8f4c0ce.tar.xz
Remove tail marker when changing an argument to an alloca.
Argument promotion can replace an argument of a call with an alloca. This requires clearing the tail marker as it is very likely that the callee is now using an alloca in the caller. This fixes pr14710. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199909 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r--lib/Transforms/IPO/ArgumentPromotion.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Transforms/IPO/ArgumentPromotion.cpp b/lib/Transforms/IPO/ArgumentPromotion.cpp
index 49a67211db..ea24d52694 100644
--- a/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -807,6 +807,16 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
I->replaceAllUsesWith(TheAlloca);
TheAlloca->takeName(I);
AA.replaceWithNewValue(I, TheAlloca);
+
+ // If the alloca is used in a call, we must clear the tail flag since
+ // the callee now uses an alloca from the caller.
+ for (Value::use_iterator UI = TheAlloca->use_begin(),
+ E = TheAlloca->use_end(); UI != E; ++UI) {
+ CallInst *Call = dyn_cast<CallInst>(*UI);
+ if (!Call)
+ continue;
+ Call->setTailCall(false);
+ }
continue;
}