1 ; RUN: opt -inline %s -S -o - | FileCheck %s
3 declare void @llvm.lifetime.start(i64, i8*)
4 declare void @llvm.lifetime.end(i64, i8*)
6 define void @helper_both_markers() {
8 call void @llvm.lifetime.start(i64 1, i8* %a)
9 call void @llvm.lifetime.end(i64 1, i8* %a)
13 define void @test_both_markers() {
14 ; CHECK: @test_both_markers
15 ; CHECK: llvm.lifetime.start(i64 1
16 ; CHECK-NEXT: llvm.lifetime.end(i64 1
17 call void @helper_both_markers()
18 ; CHECK-NEXT: llvm.lifetime.start(i64 1
19 ; CHECK-NEXT: llvm.lifetime.end(i64 1
20 call void @helper_both_markers()
21 ; CHECK-NEXT: ret void
25 ;; Without this, the inliner will simplify out @test_no_marker before adding
26 ;; any lifetime markers.
27 declare void @use(i8* %a)
29 define void @helper_no_markers() {
31 call void @use(i8* %a)
35 ;; We can't use CHECK-NEXT because there's an extra call void @use in between.
36 ;; Instead, we use CHECK-NOT to verify that there are no other lifetime calls.
37 define void @test_no_marker() {
38 ; CHECK: @test_no_marker
40 ; CHECK: llvm.lifetime.start(i64 -1
42 ; CHECK: llvm.lifetime.end(i64 -1
43 call void @helper_no_markers()
45 ; CHECK: llvm.lifetime.start(i64 -1
47 ; CHECK: llvm.lifetime.end(i64 -1
48 call void @helper_no_markers()
54 define void @helper_two_casts() {
56 %b = bitcast i32* %a to i8*
57 call void @llvm.lifetime.start(i64 4, i8* %b)
58 %c = bitcast i32* %a to i8*
59 call void @llvm.lifetime.end(i64 4, i8* %c)
63 define void @test_two_casts() {
64 ; CHECK: @test_two_casts
66 ; CHECK: llvm.lifetime.start(i64 4
68 ; CHECK: llvm.lifetime.end(i64 4
69 call void @helper_two_casts()
71 ; CHECK: llvm.lifetime.start(i64 4
73 ; CHECK: llvm.lifetime.end(i64 4
74 call void @helper_two_casts()