Skip to content

Commit 704a6ea

Browse files
committed
[asan][test] Check for __asan_stack_malloc
1 parent 3ccd88f commit 704a6ea

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

llvm/test/Instrumentation/AddressSanitizer/asan-stack-safety.ll

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
; REQUIRES: x86-registered-target
22

3-
; RUN: opt < %s -S -asan-instrumentation-with-call-threshold=0 -passes='asan-pipeline' -asan-use-stack-safety=0 -o - | FileCheck %s --implicit-check-not="call void @__asan_{{load|store}}" --check-prefixes=CHECK,NOSAFETY
4-
; RUN: opt < %s -S -asan-instrumentation-with-call-threshold=0 -passes='asan-pipeline' -asan-use-stack-safety=1 -o - | FileCheck %s --implicit-check-not="call void @__asan_{{load|store}}"
3+
; RUN: opt < %s -S -asan-instrumentation-with-call-threshold=0 -passes='asan-pipeline' -asan-use-stack-safety=0 -o - | FileCheck %s --implicit-check-not="call {{.*}} @__asan_{{load|store|stack}}" --check-prefixes=CHECK,NOSAFETY
4+
; RUN: opt < %s -S -asan-instrumentation-with-call-threshold=0 -passes='asan-pipeline' -asan-use-stack-safety=1 -o - | FileCheck %s --implicit-check-not="call {{.*}} @__asan_{{load|store|stack}}"
55

66
; CHECK-LABEL: define i32 @load
77
define i32 @load() sanitize_address {
88
%buf = alloca [10 x i8], align 1
9+
; CHECK: call i64 @__asan_stack_malloc
910
%arrayidx = getelementptr inbounds [10 x i8], [10 x i8]* %buf, i64 0, i64 0
1011
%1 = load i8, i8* %arrayidx, align 1
1112
; NOSAFETY: call void @__asan_load1
@@ -15,16 +16,17 @@ define i32 @load() sanitize_address {
1516
; CHECK-LABEL: define i32 @store
1617
define i32 @store() sanitize_address {
1718
%buf = alloca [10 x i8], align 1
19+
; CHECK: call i64 @__asan_stack_malloc
1820
%arrayidx = getelementptr inbounds [10 x i8], [10 x i8]* %buf, i64 0, i64 0
1921
store i8 0, i8* %arrayidx
2022
; NOSAFETY: call void @__asan_store1
2123
ret i32 0
2224
}
2325

24-
2526
; CHECK-LABEL: define void @atomicrmw
2627
define void @atomicrmw() sanitize_address {
2728
%buf = alloca [10 x i8], align 1
29+
; CHECK: call i64 @__asan_stack_malloc
2830
%arrayidx = getelementptr inbounds [10 x i8], [10 x i8]* %buf, i64 0, i64 0
2931
%1 = atomicrmw add i8* %arrayidx, i8 1 seq_cst
3032
; NOSAFETY: call void @__asan_store1
@@ -34,6 +36,7 @@ define void @atomicrmw() sanitize_address {
3436
; CHECK-LABEL: define void @cmpxchg
3537
define void @cmpxchg(i8 %compare_to, i8 %new_value) sanitize_address {
3638
%buf = alloca [10 x i8], align 1
39+
; CHECK: call i64 @__asan_stack_malloc
3740
%arrayidx = getelementptr inbounds [10 x i8], [10 x i8]* %buf, i64 0, i64 0
3841
%1 = cmpxchg i8* %arrayidx, i8 %compare_to, i8 %new_value seq_cst seq_cst
3942
; NOSAFETY: call void @__asan_store1

0 commit comments

Comments
 (0)