1 ; REQUIRES: x86-registered-target
3 ; RUN: opt < %s -S -asan-instrumentation-with-call-threshold=0 -passes=asan -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 -asan-use-stack-safety=1 -o - | FileCheck %s --implicit-check-not="call {{.*}} @__asan_{{load|store|stack}}"
6 ; CHECK-LABEL: define i32 @load
7 define i32 @load() sanitize_address {
8 %buf = alloca [10 x i8], align 1
9 ; NOSAFETY: call i64 @__asan_stack_malloc
10 %1 = load i8, ptr %buf, align 1
11 ; NOSAFETY: call void @__asan_load1
15 ; CHECK-LABEL: define i32 @store
16 define i32 @store() sanitize_address {
17 %buf = alloca [10 x i8], align 1
18 ; NOSAFETY: call i64 @__asan_stack_malloc
20 ; NOSAFETY: call void @__asan_store1
24 ; CHECK-LABEL: define i32 @unsafe_alloca
25 define i32 @unsafe_alloca(i32 %i) sanitize_address {
26 %buf.sroa.0 = alloca [10 x i8], align 4
27 ; CHECK: call i64 @__asan_stack_malloc
28 %ptr = getelementptr [10 x i8], ptr %buf.sroa.0, i32 %i, i32 0
29 store volatile i8 0, ptr %ptr, align 4
30 ; CHECK: call void @__asan_store1
31 store volatile i8 0, ptr %buf.sroa.0, align 4
32 ; NOSAFETY: call void @__asan_store1
36 ; CHECK-LABEL: define void @atomicrmw
37 define void @atomicrmw() sanitize_address {
38 %buf = alloca [10 x i8], align 1
39 ; NOSAFETY: call i64 @__asan_stack_malloc
40 %1 = atomicrmw add ptr %buf, i8 1 seq_cst
41 ; NOSAFETY: call void @__asan_store1
45 ; CHECK-LABEL: define void @cmpxchg
46 define void @cmpxchg(i8 %compare_to, i8 %new_value) sanitize_address {
47 %buf = alloca [10 x i8], align 1
48 ; NOSAFETY: call i64 @__asan_stack_malloc
49 %1 = cmpxchg ptr %buf, i8 %compare_to, i8 %new_value seq_cst seq_cst
50 ; NOSAFETY: call void @__asan_store1