1 ; RUN: opt < %s -passes=asan -asan-instrumentation-with-call-threshold=0 -asan-optimize-callbacks -S | FileCheck %s --check-prefixes=LOAD,STORE
2 ; RUN: opt < %s -passes=asan -asan-instrumentation-with-call-threshold=0 -asan-optimize-callbacks --asan-kernel -S | FileCheck %s --check-prefixes=LOAD-KERNEL,STORE-KERNEL
4 target triple = "x86_64-unknown-linux-gnu"
6 define void @load(ptr %p1, ptr %p2, ptr %p4, ptr %p8, ptr %p16)
8 %n1 = load i8, ptr %p1, align 1
9 %n2 = load i16, ptr %p2, align 2
10 %n4 = load i32, ptr %p4, align 4
11 %n8 = load i64, ptr %p8, align 8
12 %n16 = load i128, ptr %p16, align 16
13 ; LOAD: call void @llvm.asan.check.memaccess(ptr %p1, i32 0)
14 ; LOAD-NEXT: %n1 = load i8, ptr %p1, align 1
15 ; LOAD-NEXT: call void @llvm.asan.check.memaccess(ptr %p2, i32 2)
16 ; LOAD-NEXT: %n2 = load i16, ptr %p2, align 2
17 ; LOAD-NEXT: call void @llvm.asan.check.memaccess(ptr %p4, i32 4)
18 ; LOAD-NEXT: %n4 = load i32, ptr %p4, align 4
19 ; LOAD-NEXT: call void @llvm.asan.check.memaccess(ptr %p8, i32 6)
20 ; LOAD-NEXT: %n8 = load i64, ptr %p8, align 8
21 ; LOAD-NEXT: call void @llvm.asan.check.memaccess(ptr %p16, i32 8)
22 ; LOAD-NEXT: %n16 = load i128, ptr %p16, align 16
24 ; LOAD-KERNEL: call void @llvm.asan.check.memaccess(ptr %p1, i32 1)
25 ; LOAD-KERNEL-NEXT: %n1 = load i8, ptr %p1, align 1
26 ; LOAD-KERNEL-NEXT: call void @llvm.asan.check.memaccess(ptr %p2, i32 3)
27 ; LOAD-KERNEL-NEXT: %n2 = load i16, ptr %p2, align 2
28 ; LOAD-KERNEL-NEXT: call void @llvm.asan.check.memaccess(ptr %p4, i32 5)
29 ; LOAD-KERNEL-NEXT: %n4 = load i32, ptr %p4, align 4
30 ; LOAD-KERNEL-NEXT: call void @llvm.asan.check.memaccess(ptr %p8, i32 7)
31 ; LOAD-KERNEL-NEXT: %n8 = load i64, ptr %p8, align 8
32 ; LOAD-KERNEL-NEXT: call void @llvm.asan.check.memaccess(ptr %p16, i32 9)
33 ; LOAD-KERNEL-NEXT: %n16 = load i128, ptr %p16, align 16
37 define void @store(ptr %p1, ptr %p2, ptr %p4, ptr %p8, ptr %p16)
39 store i8 0, ptr %p1, align 1
40 store i16 0, ptr %p2, align 2
41 store i32 0, ptr %p4, align 4
42 store i64 0, ptr %p8, align 8
43 store i128 0, ptr %p16, align 16
44 ; STORE: call void @llvm.asan.check.memaccess(ptr %p1, i32 32)
45 ; STORE-NEXT: store i8 0, ptr %p1, align 1
46 ; STORE-NEXT: call void @llvm.asan.check.memaccess(ptr %p2, i32 34)
47 ; STORE-NEXT: store i16 0, ptr %p2, align 2
48 ; STORE-NEXT: call void @llvm.asan.check.memaccess(ptr %p4, i32 36)
49 ; STORE-NEXT: store i32 0, ptr %p4, align 4
50 ; STORE-NEXT: call void @llvm.asan.check.memaccess(ptr %p8, i32 38)
51 ; STORE-NEXT: store i64 0, ptr %p8, align 8
52 ; STORE-NEXT: call void @llvm.asan.check.memaccess(ptr %p16, i32 40)
53 ; STORE-NEXT: store i128 0, ptr %p16, align 16
55 ; STORE-KERNEL: call void @llvm.asan.check.memaccess(ptr %p1, i32 33)
56 ; STORE-KERNEL-NEXT: store i8 0, ptr %p1, align 1
57 ; STORE-KERNEL-NEXT: call void @llvm.asan.check.memaccess(ptr %p2, i32 35)
58 ; STORE-KERNEL-NEXT: store i16 0, ptr %p2, align 2
59 ; STORE-KERNEL-NEXT: call void @llvm.asan.check.memaccess(ptr %p4, i32 37)
60 ; STORE-KERNEL-NEXT: store i32 0, ptr %p4, align 4
61 ; STORE-KERNEL-NEXT: call void @llvm.asan.check.memaccess(ptr %p8, i32 39)
62 ; STORE-KERNEL-NEXT: store i64 0, ptr %p8, align 8
63 ; STORE-KERNEL-NEXT: call void @llvm.asan.check.memaccess(ptr %p16, i32 41)
64 ; STORE-KERNEL-NEXT: store i128 0, ptr %p16, align 16
65 ; STORE-KERNEL-NEXT: ret void