Teach InstCombine that lifetime intrincs aren't a real user on the result of a
[oota-llvm.git] / test / Transforms / InstCombine / malloc-free-delete.ll
index 8455300c98cad13536bbf45beff09fc5d1f5fdba..a35e7b646a489c1c119a2c222b51f8e342065c5d 100644 (file)
@@ -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
+}