summaryrefslogtreecommitdiff
path: root/test/Instrumentation/AddressSanitizer
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2012-12-27 08:50:58 +0000
committerAlexey Samsonov <samsonov@google.com>2012-12-27 08:50:58 +0000
commit1c8b825c4396ad9cd38f713d9e9a51adae1d4c4e (patch)
treef665d2a924ea570d07b361cbbe1d60b6d84f21f2 /test/Instrumentation/AddressSanitizer
parent3190be9c9a9f4c69591f78ed65dd7b06dd6c80c1 (diff)
downloadllvm-1c8b825c4396ad9cd38f713d9e9a51adae1d4c4e.tar.gz
llvm-1c8b825c4396ad9cd38f713d9e9a51adae1d4c4e.tar.bz2
llvm-1c8b825c4396ad9cd38f713d9e9a51adae1d4c4e.tar.xz
[ASan] Fix lifetime intrinsics handling. Now for each intrinsic we check if it describes one of 'interesting' allocas. Assume that allocas can go through casts and phi-nodes before apperaring as llvm.lifetime arguments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171153 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Instrumentation/AddressSanitizer')
-rw-r--r--test/Instrumentation/AddressSanitizer/lifetime.ll25
1 files changed, 24 insertions, 1 deletions
diff --git a/test/Instrumentation/AddressSanitizer/lifetime.ll b/test/Instrumentation/AddressSanitizer/lifetime.ll
index 55cd475f1f..982ad085ec 100644
--- a/test/Instrumentation/AddressSanitizer/lifetime.ll
+++ b/test/Instrumentation/AddressSanitizer/lifetime.ll
@@ -31,7 +31,7 @@ define void @lifetime() address_safety {
%i.ptr = bitcast i32* %i to i8*
call void @llvm.lifetime.start(i64 3, i8* %i.ptr)
; Memory is unpoisoned at llvm.lifetime.start
- ; CHECK: %[[VAR:[^ ]*]] = ptrtoint i8* %i.ptr to i64
+ ; CHECK: %[[VAR:[^ ]*]] = ptrtoint i32* %{{[^ ]+}} to i64
; CHECK-NEXT: call void @__asan_unpoison_stack_memory(i64 %[[VAR]], i64 3)
call void @llvm.lifetime.end(i64 4, i8* %i.ptr)
call void @llvm.lifetime.end(i64 2, i8* %i.ptr)
@@ -59,3 +59,26 @@ define void @lifetime() address_safety {
; CHECK: ret void
ret void
}
+
+; Check that arguments of lifetime may come from phi nodes.
+define void @phi_args(i1 %x) address_safety {
+ ; CHECK: @phi_args
+
+entry:
+ %i = alloca i64, align 4
+ %i.ptr = bitcast i64* %i to i8*
+ call void @llvm.lifetime.start(i64 8, i8* %i.ptr)
+ ; CHECK: __asan_unpoison_stack_memory
+ br i1 %x, label %bb0, label %bb1
+
+bb0:
+ %i.ptr2 = bitcast i64* %i to i8*
+ br label %bb1
+
+bb1:
+ %i.phi = phi i8* [ %i.ptr, %entry ], [ %i.ptr2, %bb0 ]
+ call void @llvm.lifetime.end(i64 8, i8* %i.phi)
+ ; CHECK: __asan_poison_stack_memory
+ ; CHECK: ret void
+ ret void
+}