1 ; Test optimization experiments.
2 ; -asan-force-experiment flag turns all memory accesses into experiments.
3 ; RUN: opt < %s -passes=asan -asan-force-experiment=42 -S | FileCheck %s
4 ; RUN: opt < %s -passes=asan -asan-force-experiment=42 -S -mtriple=s390x-unknown-linux | FileCheck %s --check-prefix=EXT
5 ; RUN: opt < %s -passes=asan -asan-force-experiment=42 -S -mtriple=mips-linux-gnu | FileCheck %s --check-prefix=MIPS_EXT
6 ; RUN: opt < %s -passes=asan -asan-force-experiment=42 -S -mtriple=loongarch64-unknown-linux-gnu | FileCheck %s --check-prefix=LA_EXT
7 ; REQUIRES: x86-registered-target, systemz-registered-target, mips-registered-target, loongarch-registered-target
9 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
10 target triple = "x86_64-unknown-linux-gnu"
12 define void @load1(ptr %p) sanitize_address {
14 %t = load i8, ptr %p, align 1
16 ; CHECK-LABEL: define void @load1
17 ; CHECK: __asan_report_exp_load1{{.*}} i32 42
21 define void @load2(ptr %p) sanitize_address {
23 %t = load i16, ptr %p, align 2
25 ; CHECK-LABEL: define void @load2
26 ; CHECK: __asan_report_exp_load2{{.*}} i32 42
30 define void @load4(ptr %p) sanitize_address {
32 %t = load i32, ptr %p, align 4
34 ; CHECK-LABEL: define void @load4
35 ; CHECK: __asan_report_exp_load4{{.*}} i32 42
39 define void @load8(ptr %p) sanitize_address {
41 %t = load i64, ptr %p, align 8
43 ; CHECK-LABEL: define void @load8
44 ; CHECK: __asan_report_exp_load8{{.*}} i32 42
48 define void @load16(ptr %p) sanitize_address {
50 %t = load i128, ptr %p, align 16
52 ; CHECK-LABEL: define void @load16
53 ; CHECK: __asan_report_exp_load16{{.*}} i32 42
57 define void @loadN(ptr %p) sanitize_address {
59 %t = load i48, ptr %p, align 1
61 ; CHECK-LABEL: define void @loadN
62 ; CHECK: __asan_report_exp_load_n{{.*}} i32 42
66 define void @store1(ptr %p) sanitize_address {
68 store i8 1, ptr %p, align 1
70 ; CHECK-LABEL: define void @store1
71 ; CHECK: __asan_report_exp_store1{{.*}} i32 42
75 define void @store2(ptr %p) sanitize_address {
77 store i16 1, ptr %p, align 2
79 ; CHECK-LABEL: define void @store2
80 ; CHECK: __asan_report_exp_store2{{.*}} i32 42
84 define void @store4(ptr %p) sanitize_address {
86 store i32 1, ptr %p, align 4
88 ; CHECK-LABEL: define void @store4
89 ; CHECK: __asan_report_exp_store4{{.*}} i32 42
93 define void @store8(ptr %p) sanitize_address {
95 store i64 1, ptr %p, align 8
97 ; CHECK-LABEL: define void @store8
98 ; CHECK: __asan_report_exp_store8{{.*}} i32 42
102 define void @store16(ptr %p) sanitize_address {
104 store i128 1, ptr %p, align 16
106 ; CHECK-LABEL: define void @store16
107 ; CHECK: __asan_report_exp_store16{{.*}} i32 42
111 define void @storeN(ptr %p) sanitize_address {
113 store i48 1, ptr %p, align 1
115 ; CHECK-LABEL: define void @storeN
116 ; CHECK: __asan_report_exp_store_n{{.*}} i32 42
120 ; CHECK: declare void @__asan_report_exp_load_n(i64, i64, i32)
121 ; EXT: declare void @__asan_report_exp_load_n(i64, i64, i32 zeroext)
122 ; MIPS_EXT: declare void @__asan_report_exp_load_n(i64, i64, i32 signext)
123 ; LA_EXT: declare void @__asan_report_exp_load_n(i64, i64, i32 signext)
125 ; CHECK: declare void @__asan_exp_loadN(i64, i64, i32)
126 ; EXT: declare void @__asan_exp_loadN(i64, i64, i32 zeroext)
127 ; MIPS_EXT: declare void @__asan_exp_loadN(i64, i64, i32 signext)
128 ; LA_EXT: declare void @__asan_exp_loadN(i64, i64, i32 signext)
130 ; CHECK: declare void @__asan_report_exp_load1(i64, i32)
131 ; EXT: declare void @__asan_report_exp_load1(i64, i32 zeroext)
132 ; MIPS_EXT: declare void @__asan_report_exp_load1(i64, i32 signext)
133 ; LA_EXT: declare void @__asan_report_exp_load1(i64, i32 signext)
135 ; CHECK: declare void @__asan_exp_load1(i64, i32)
136 ; EXT: declare void @__asan_exp_load1(i64, i32 zeroext)
137 ; MIPS_EXT: declare void @__asan_exp_load1(i64, i32 signext)
138 ; LA_EXT: declare void @__asan_exp_load1(i64, i32 signext)