diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2011-08-02 22:08:01 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2011-08-02 22:08:01 +0000 |
commit | d8030c79fd4531a691381e7e870fe99b8a4cb8a4 (patch) | |
tree | 7b239073981a96487c4da6b27e7657e7c762e8af /test | |
parent | 0e0a8806d49038b60a0c20427d9f410b01cbb012 (diff) | |
download | external_llvm-d8030c79fd4531a691381e7e870fe99b8a4cb8a4.zip external_llvm-d8030c79fd4531a691381e7e870fe99b8a4cb8a4.tar.gz external_llvm-d8030c79fd4531a691381e7e870fe99b8a4cb8a4.tar.bz2 |
Teach InstCombine that lifetime intrincs aren't a real user on the result of a
malloc call.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136732 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/InstCombine/malloc-free-delete.ll | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test/Transforms/InstCombine/malloc-free-delete.ll b/test/Transforms/InstCombine/malloc-free-delete.ll index 8455300..a35e7b6 100644 --- a/test/Transforms/InstCombine/malloc-free-delete.ll +++ b/test/Transforms/InstCombine/malloc-free-delete.ll @@ -12,7 +12,7 @@ define i32 @main(i32 %argc, i8** %argv) { ; CHECK: ret i32 0 } -declare i8* @malloc(i32) +declare noalias i8* @malloc(i32) declare void @free(i8*) define i1 @foo() { @@ -23,3 +23,15 @@ define i1 @foo() { call void @free(i8* %m) ret i1 %z } + +declare void @llvm.lifetime.start(i64, i8*) +declare void @llvm.lifetime.end(i64, i8*) + +define void @test3() { +; CHECK: @test3 +; CHECK-NEXT: ret void + %a = call noalias i8* @malloc(i32 10) + call void @llvm.lifetime.start(i64 10, i8* %a) + call void @llvm.lifetime.end(i64 10, i8* %a) + ret void +} |