diff options
| author | Reid Kleckner <reid@kleckner.net> | 2014-05-15 20:39:13 +0000 |
|---|---|---|
| committer | Reid Kleckner <reid@kleckner.net> | 2014-05-15 20:39:13 +0000 |
| commit | 26ab7ead45b37e22dd6f4a7704ca11fb2a47ca43 (patch) | |
| tree | d38caa93e47c4a3e89d3e77e20e877b33680d1f6 /llvm/test/Transforms | |
| parent | 4c6d987b069dc5738318ec0fa7c040e34ad84127 (diff) | |
| download | bcm5719-llvm-26ab7ead45b37e22dd6f4a7704ca11fb2a47ca43.tar.gz bcm5719-llvm-26ab7ead45b37e22dd6f4a7704ca11fb2a47ca43.zip | |
Don't insert lifetime.end markers between a musttail call and ret
The allocas going out of scope are immediately killed by the return
instruction.
Reviewers: chandlerc
Differential Revision: http://reviews.llvm.org/D3630
llvm-svn: 208912
Diffstat (limited to 'llvm/test/Transforms')
| -rw-r--r-- | llvm/test/Transforms/Inline/inline-tail.ll | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/llvm/test/Transforms/Inline/inline-tail.ll b/llvm/test/Transforms/Inline/inline-tail.ll index 565491adf5b..b40328e0a27 100644 --- a/llvm/test/Transforms/Inline/inline-tail.ll +++ b/llvm/test/Transforms/Inline/inline-tail.ll @@ -49,6 +49,42 @@ define void @test_musttail_basic_a(i32* %p) { 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( |

