Mercurial > hg > Members > tobaru > cbc > CbC_llvm
comparison test/Instrumentation/AddressSanitizer/lifetime.ll @ 95:afa8332a0e37
LLVM 3.8
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 13 Oct 2015 17:48:58 +0900 |
parents | 54457678186b |
children | 1172e4bd9c6f |
comparison
equal
deleted
inserted
replaced
84:f3e34b893a5f | 95:afa8332a0e37 |
---|---|
10 define void @lifetime_no_size() sanitize_address { | 10 define void @lifetime_no_size() sanitize_address { |
11 entry: | 11 entry: |
12 %i = alloca i32, align 4 | 12 %i = alloca i32, align 4 |
13 %i.ptr = bitcast i32* %i to i8* | 13 %i.ptr = bitcast i32* %i to i8* |
14 call void @llvm.lifetime.start(i64 -1, i8* %i.ptr) | 14 call void @llvm.lifetime.start(i64 -1, i8* %i.ptr) |
15 store volatile i8 0, i8* %i.ptr | |
15 call void @llvm.lifetime.end(i64 -1, i8* %i.ptr) | 16 call void @llvm.lifetime.end(i64 -1, i8* %i.ptr) |
16 | 17 |
17 ; Check that lifetime with no size are ignored. | 18 ; Check that lifetime with no size are ignored. |
18 ; CHECK-LABEL: define void @lifetime_no_size() | 19 ; CHECK-LABEL: define void @lifetime_no_size() |
19 ; CHECK-NOT: @__asan_poison_stack_memory | 20 ; CHECK-NOT: @__asan_poison_stack_memory |
28 | 29 |
29 ; Regular variable lifetime intrinsics. | 30 ; Regular variable lifetime intrinsics. |
30 %i = alloca i32, align 4 | 31 %i = alloca i32, align 4 |
31 %i.ptr = bitcast i32* %i to i8* | 32 %i.ptr = bitcast i32* %i to i8* |
32 call void @llvm.lifetime.start(i64 3, i8* %i.ptr) | 33 call void @llvm.lifetime.start(i64 3, i8* %i.ptr) |
34 store volatile i8 0, i8* %i.ptr | |
33 ; Memory is unpoisoned at llvm.lifetime.start | 35 ; Memory is unpoisoned at llvm.lifetime.start |
34 ; CHECK: %[[VAR:[^ ]*]] = ptrtoint i32* %{{[^ ]+}} to i64 | 36 ; CHECK: %[[VAR:[^ ]*]] = ptrtoint i32* %{{[^ ]+}} to i64 |
35 ; CHECK-NEXT: call void @__asan_unpoison_stack_memory(i64 %[[VAR]], i64 3) | 37 ; CHECK-NEXT: call void @__asan_unpoison_stack_memory(i64 %[[VAR]], i64 3) |
36 call void @llvm.lifetime.end(i64 4, i8* %i.ptr) | 38 call void @llvm.lifetime.end(i64 4, i8* %i.ptr) |
37 call void @llvm.lifetime.end(i64 2, i8* %i.ptr) | 39 call void @llvm.lifetime.end(i64 2, i8* %i.ptr) |
41 | 43 |
42 ; Lifetime intrinsics for array. | 44 ; Lifetime intrinsics for array. |
43 %arr = alloca [10 x i32], align 16 | 45 %arr = alloca [10 x i32], align 16 |
44 %arr.ptr = bitcast [10 x i32]* %arr to i8* | 46 %arr.ptr = bitcast [10 x i32]* %arr to i8* |
45 call void @llvm.lifetime.start(i64 40, i8* %arr.ptr) | 47 call void @llvm.lifetime.start(i64 40, i8* %arr.ptr) |
48 store volatile i8 0, i8* %arr.ptr | |
46 ; CHECK: call void @__asan_unpoison_stack_memory(i64 %{{[^ ]+}}, i64 40) | 49 ; CHECK: call void @__asan_unpoison_stack_memory(i64 %{{[^ ]+}}, i64 40) |
47 call void @llvm.lifetime.end(i64 40, i8* %arr.ptr) | 50 call void @llvm.lifetime.end(i64 40, i8* %arr.ptr) |
48 ; CHECK: call void @__asan_poison_stack_memory(i64 %{{[^ ]+}}, i64 40) | 51 ; CHECK: call void @__asan_poison_stack_memory(i64 %{{[^ ]+}}, i64 40) |
49 | 52 |
50 ; One more lifetime start/end for the same variable %i. | 53 ; One more lifetime start/end for the same variable %i. |
51 call void @llvm.lifetime.start(i64 4, i8* %i.ptr) | 54 call void @llvm.lifetime.start(i64 4, i8* %i.ptr) |
55 store volatile i8 0, i8* %i.ptr | |
52 ; CHECK: call void @__asan_unpoison_stack_memory(i64 %{{[^ ]+}}, i64 4) | 56 ; CHECK: call void @__asan_unpoison_stack_memory(i64 %{{[^ ]+}}, i64 4) |
53 call void @llvm.lifetime.end(i64 4, i8* %i.ptr) | 57 call void @llvm.lifetime.end(i64 4, i8* %i.ptr) |
54 ; CHECK: call void @__asan_poison_stack_memory(i64 %{{[^ ]+}}, i64 4) | 58 ; CHECK: call void @__asan_poison_stack_memory(i64 %{{[^ ]+}}, i64 4) |
55 | 59 |
56 ; Memory is unpoisoned at function exit (only once). | 60 ; Memory is unpoisoned at function exit (only once). |
66 | 70 |
67 entry: | 71 entry: |
68 %i = alloca i64, align 4 | 72 %i = alloca i64, align 4 |
69 %i.ptr = bitcast i64* %i to i8* | 73 %i.ptr = bitcast i64* %i to i8* |
70 call void @llvm.lifetime.start(i64 8, i8* %i.ptr) | 74 call void @llvm.lifetime.start(i64 8, i8* %i.ptr) |
75 store volatile i8 0, i8* %i.ptr | |
71 ; CHECK: __asan_unpoison_stack_memory | 76 ; CHECK: __asan_unpoison_stack_memory |
72 br i1 %x, label %bb0, label %bb1 | 77 br i1 %x, label %bb0, label %bb1 |
73 | 78 |
74 bb0: | 79 bb0: |
75 %i.ptr2 = bitcast i64* %i to i8* | 80 %i.ptr2 = bitcast i64* %i to i8* |