[llvm] r208914 - Revert "Don't insert lifetime.end markers between a musttail call and ret"
Reid Kleckner
reid at kleckner.net
Thu May 15 13:41:05 PDT 2014
Author: rnk
Date: Thu May 15 15:41:05 2014
New Revision: 208914
URL: http://llvm.org/viewvc/llvm-project?rev=208914&view=rev
Log:
Revert "Don't insert lifetime.end markers between a musttail call and ret"
This reverts commit r208912.
It was committed accidentally without review.
Modified:
llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
llvm/trunk/test/Transforms/Inline/inline-tail.ll
Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=208914&r1=208913&r2=208914&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Thu May 15 15:41:05 2014
@@ -755,13 +755,8 @@ bool llvm::InlineFunction(CallSite CS, I
}
builder.CreateLifetimeStart(AI, AllocaSize);
- for (ReturnInst *RI : Returns) {
- // Don't insert llvm.lifetime.end calls between a musttail call and a
- // return. The return kills all local allocas.
- if (InlinedMustTailCalls && getPrecedingMustTailCall(RI))
- continue;
+ for (ReturnInst *RI : Returns)
IRBuilder<>(RI).CreateLifetimeEnd(AI, AllocaSize);
- }
}
}
@@ -779,13 +774,8 @@ bool llvm::InlineFunction(CallSite CS, I
// Insert a call to llvm.stackrestore before any return instructions in the
// inlined function.
- for (ReturnInst *RI : Returns) {
- // Don't insert llvm.stackrestore calls between a musttail call and a
- // return. The return will restore the stack pointer.
- if (InlinedMustTailCalls && getPrecedingMustTailCall(RI))
- continue;
+ for (ReturnInst *RI : Returns)
IRBuilder<>(RI).CreateCall(StackRestore, SavedPtr);
- }
}
// If we are inlining for an invoke instruction, we must make sure to rewrite
Modified: llvm/trunk/test/Transforms/Inline/inline-tail.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/inline-tail.ll?rev=208914&r1=208913&r2=208914&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Inline/inline-tail.ll (original)
+++ llvm/trunk/test/Transforms/Inline/inline-tail.ll Thu May 15 15:41:05 2014
@@ -49,42 +49,6 @@ define void @test_musttail_basic_a(i32*
ret void
}
-; Don't insert lifetime end markers here, the lifetime is trivially over due
-; the return.
-; CHECK: define void @test_byval_a(
-; CHECK: musttail call void @test_byval_c(
-; CHECK-NEXT: ret void
-
-declare void @test_byval_c(i32* byval %p)
-define internal void @test_byval_b(i32* byval %p) {
- musttail call void @test_byval_c(i32* byval %p)
- ret void
-}
-define void @test_byval_a(i32* byval %p) {
- musttail call void @test_byval_b(i32* byval %p)
- ret void
-}
-
-; Don't insert a stack restore, we're about to return.
-; CHECK: define void @test_dynalloca_a(
-; CHECK: call i8* @llvm.stacksave(
-; CHECK: alloca i8, i32 %n
-; CHECK: musttail call void @test_dynalloca_c(
-; CHECK-NEXT: ret void
-
-declare void @escape(i8* %buf)
-declare void @test_dynalloca_c(i32* byval %p, i32 %n)
-define internal void @test_dynalloca_b(i32* byval %p, i32 %n) alwaysinline {
- %buf = alloca i8, i32 %n ; dynamic alloca
- call void @escape(i8* %buf) ; escape it
- musttail call void @test_dynalloca_c(i32* byval %p, i32 %n)
- ret void
-}
-define void @test_dynalloca_a(i32* byval %p, i32 %n) {
- musttail call void @test_dynalloca_b(i32* byval %p, i32 %n)
- ret void
-}
-
; We can't merge the returns.
; CHECK: define void @test_multiret_a(
; CHECK: musttail call void @test_multiret_c(
More information about the llvm-commits
mailing list