aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/InlineFunction.cpp
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2014-11-04 02:02:14 +0000
committerReid Kleckner <reid@kleckner.net>2014-11-04 02:02:14 +0000
commitdd3f3edafadc92d603920c3b96bf331d0c3a9341 (patch)
tree7b6b949b65280988aca1887d1c7a330fec1c7124 /llvm/lib/Transforms/Utils/InlineFunction.cpp
parent8f1632d5c1e32912365f5673d832e0e8c8080a89 (diff)
downloadllvm-dd3f3edafadc92d603920c3b96bf331d0c3a9341.zip
llvm-dd3f3edafadc92d603920c3b96bf331d0c3a9341.tar.gz
llvm-dd3f3edafadc92d603920c3b96bf331d0c3a9341.tar.bz2
Revert "Transforms: reapply SVN r219899"
This reverts commit r220811 and r220839. It made an incorrect change to musttail handling. llvm-svn: 221226
Diffstat (limited to 'llvm/lib/Transforms/Utils/InlineFunction.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/InlineFunction.cpp19
1 files changed, 3 insertions, 16 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp
index 112bdcb..a1e42bb 100644
--- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -743,8 +743,7 @@ static void HandleByValArgumentInit(Value *Dst, Value *Src, Module *M,
static Value *HandleByValArgument(Value *Arg, Instruction *TheCall,
const Function *CalledFunc,
InlineFunctionInfo &IFI,
- unsigned ByValAlignment,
- bool &AddedNewAllocas) {
+ unsigned ByValAlignment) {
PointerType *ArgTy = cast<PointerType>(Arg->getType());
Type *AggTy = ArgTy->getElementType();
@@ -786,7 +785,6 @@ static Value *HandleByValArgument(Value *Arg, Instruction *TheCall,
// Uses of the argument in the function should use our new alloca
// instead.
- AddedNewAllocas = true;
return NewAlloca;
}
@@ -960,7 +958,6 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI,
SmallVector<ReturnInst*, 8> Returns;
ClonedCodeInfo InlinedFunctionInfo;
Function::iterator FirstNewBlock;
- bool AddedNewAllocas = false;
{ // Scope to destroy VMap after cloning.
ValueToValueMapTy VMap;
@@ -984,8 +981,7 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI,
// modify the struct.
if (CS.isByValArgument(ArgNo)) {
ActualArg = HandleByValArgument(ActualArg, TheCall, CalledFunc, IFI,
- CalledFunc->getParamAlignment(ArgNo+1),
- AddedNewAllocas);
+ CalledFunc->getParamAlignment(ArgNo+1));
if (ActualArg != *AI)
ByValInit.push_back(std::make_pair(ActualArg, (Value*) *AI));
}
@@ -1100,18 +1096,9 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI,
// f -> musttail g -> tail f ==> f -> tail f
// f -> g -> musttail f ==> f -> f
// f -> g -> tail f ==> f -> f
- //
- // If an alloca was introduced in the frame due to a byval parameter
- // being passed to a subsequent call, tail calls must have the tail
- // stripped as they may not access variables in the caller's stack.
- // A single alloca ripples through out as the alloca may be aliased by
- // bitcasts or may escape and be mutated outside of the function.
CallInst::TailCallKind ChildTCK = CI->getTailCallKind();
ChildTCK = std::min(CallSiteTailKind, ChildTCK);
- if (AddedNewAllocas)
- CI->setTailCallKind(CallInst::TCK_None);
- else
- CI->setTailCallKind(ChildTCK);
+ CI->setTailCallKind(ChildTCK);
InlinedMustTailCalls |= CI->isMustTailCall();
// Calls inlined through a 'nounwind' call site should be marked