OLD | NEW |
1 ; Test for a call to __asan_check() preceding loads | 1 ; Test for a call to __asan_check() preceding loads |
2 | 2 |
3 ; REQUIRES: allow_dump | 3 ; REQUIRES: allow_dump |
4 | 4 |
5 ; RUN: %p2i -i %s --args -verbose=inst -threads=0 -fsanitize-address \ | 5 ; RUN: %p2i -i %s --args -verbose=inst -threads=0 -fsanitize-address \ |
6 ; RUN: | FileCheck --check-prefix=DUMP %s | 6 ; RUN: | FileCheck --check-prefix=DUMP %s |
7 | 7 |
8 ; Constants to load data from | |
9 @srcConst8 = internal constant [1 x i8] c"D" | |
10 @srcConst16 = internal constant [2 x i8] c"DA" | |
11 @srcConst32 = internal constant [4 x i8] c"DATA" | |
12 @srcConst64 = internal constant [8 x i8] c"DATADATA" | |
13 @srcConst128 = internal constant [16 x i8] c"DATADATADATADATA" | |
14 | |
15 ; A global to load data from | |
16 @srcGlobal8 = internal global [1 x i8] c"D" | |
17 @srcGlobal16 = internal global [2 x i8] c"DA" | |
18 @srcGlobal32 = internal global [4 x i8] c"DATA" | |
19 @srcGlobal64 = internal global [8 x i8] c"DATADATA" | |
20 @srcGlobal128 = internal global [16 x i8] c"DATADATADATADATA" | |
21 | |
22 ; A function with a local variable that does the loads | 8 ; A function with a local variable that does the loads |
23 define internal void @doLoads(i32 %arg8, i32 %arg16, i32 %arg32, i32 %arg64, | 9 define internal void @doLoads(i32 %arg8, i32 %arg16, i32 %arg32, i32 %arg64, |
24 i32 %arg128) { | 10 i32 %arg128) { |
25 %srcLocal8 = inttoptr i32 %arg8 to i8* | 11 %srcLocal8 = inttoptr i32 %arg8 to i8* |
26 %srcLocal16 = inttoptr i32 %arg16 to i16* | 12 %srcLocal16 = inttoptr i32 %arg16 to i16* |
27 %srcLocal32 = inttoptr i32 %arg32 to i32* | 13 %srcLocal32 = inttoptr i32 %arg32 to i32* |
28 %srcLocal64 = inttoptr i32 %arg64 to i64* | 14 %srcLocal64 = inttoptr i32 %arg64 to i64* |
29 %srcLocal128 = inttoptr i32 %arg128 to <4 x i32>* | 15 %srcLocal128 = inttoptr i32 %arg128 to <4 x i32>* |
30 | 16 |
31 %ptrConst8 = bitcast [1 x i8]* @srcConst8 to i8* | |
32 %ptrConst16 = bitcast [2 x i8]* @srcConst16 to i16* | |
33 %ptrConst32 = bitcast [4 x i8]* @srcConst32 to i32* | |
34 %ptrConst64 = bitcast [8 x i8]* @srcConst64 to i64* | |
35 %ptrConst128 = bitcast [16 x i8]* @srcConst128 to <4 x i32>* | |
36 | |
37 %ptrGlobal8 = bitcast [1 x i8]* @srcGlobal8 to i8* | |
38 %ptrGlobal16 = bitcast [2 x i8]* @srcGlobal16 to i16* | |
39 %ptrGlobal32 = bitcast [4 x i8]* @srcGlobal32 to i32* | |
40 %ptrGlobal64 = bitcast [8 x i8]* @srcGlobal64 to i64* | |
41 %ptrGlobal128 = bitcast [16 x i8]* @srcGlobal128 to <4 x i32>* | |
42 | |
43 %dest1 = load i8, i8* %ptrConst8, align 1 | |
44 %dest2 = load i16, i16* %ptrConst16, align 1 | |
45 %dest3 = load i32, i32* %ptrConst32, align 1 | |
46 %dest4 = load i64, i64* %ptrConst64, align 1 | |
47 %dest5 = load <4 x i32>, <4 x i32>* %ptrConst128, align 4 | |
48 | |
49 %dest6 = load i8, i8* %ptrGlobal8, align 1 | |
50 %dest7 = load i16, i16* %ptrGlobal16, align 1 | |
51 %dest8 = load i32, i32* %ptrGlobal32, align 1 | |
52 %dest9 = load i64, i64* %ptrGlobal64, align 1 | |
53 %dest10 = load <4 x i32>, <4 x i32>* %ptrGlobal128, align 4 | |
54 | |
55 %dest11 = load i8, i8* %srcLocal8, align 1 | 17 %dest11 = load i8, i8* %srcLocal8, align 1 |
56 %dest12 = load i16, i16* %srcLocal16, align 1 | 18 %dest12 = load i16, i16* %srcLocal16, align 1 |
57 %dest13 = load i32, i32* %srcLocal32, align 1 | 19 %dest13 = load i32, i32* %srcLocal32, align 1 |
58 %dest14 = load i64, i64* %srcLocal64, align 1 | 20 %dest14 = load i64, i64* %srcLocal64, align 1 |
59 %dest15 = load <4 x i32>, <4 x i32>* %srcLocal128, align 4 | 21 %dest15 = load <4 x i32>, <4 x i32>* %srcLocal128, align 4 |
60 | 22 |
61 ret void | 23 ret void |
62 } | 24 } |
63 | 25 |
64 ; DUMP-LABEL: ================ Instrumented CFG ================ | 26 ; DUMP-LABEL: ================ Instrumented CFG ================ |
65 ; DUMP-NEXT: define internal void @doLoads( | 27 ; DUMP-NEXT: define internal void @doLoads( |
66 ; DUMP-NEXT: __0: | 28 ; DUMP-NEXT: __0: |
67 ; DUMP-NEXT: call void @__asan_check_load(i32 @srcConst8, i32 1) | |
68 ; DUMP-NEXT: %dest1 = load i8, i8* @srcConst8, align 1 | |
69 ; DUMP-NEXT: call void @__asan_check_load(i32 @srcConst16, i32 2) | |
70 ; DUMP-NEXT: %dest2 = load i16, i16* @srcConst16, align 1 | |
71 ; DUMP-NEXT: call void @__asan_check_load(i32 @srcConst32, i32 4) | |
72 ; DUMP-NEXT: %dest3 = load i32, i32* @srcConst32, align 1 | |
73 ; DUMP-NEXT: call void @__asan_check_load(i32 @srcConst64, i32 8) | |
74 ; DUMP-NEXT: %dest4 = load i64, i64* @srcConst64, align 1 | |
75 ; DUMP-NEXT: call void @__asan_check_load(i32 @srcConst128, i32 16) | |
76 ; DUMP-NEXT: %dest5 = load <4 x i32>, <4 x i32>* @srcConst128, align 4 | |
77 ; DUMP-NEXT: call void @__asan_check_load(i32 @srcGlobal8, i32 1) | |
78 ; DUMP-NEXT: %dest6 = load i8, i8* @srcGlobal8, align 1 | |
79 ; DUMP-NEXT: call void @__asan_check_load(i32 @srcGlobal16, i32 2) | |
80 ; DUMP-NEXT: %dest7 = load i16, i16* @srcGlobal16, align 1 | |
81 ; DUMP-NEXT: call void @__asan_check_load(i32 @srcGlobal32, i32 4) | |
82 ; DUMP-NEXT: %dest8 = load i32, i32* @srcGlobal32, align 1 | |
83 ; DUMP-NEXT: call void @__asan_check_load(i32 @srcGlobal64, i32 8) | |
84 ; DUMP-NEXT: %dest9 = load i64, i64* @srcGlobal64, align 1 | |
85 ; DUMP-NEXT: call void @__asan_check_load(i32 @srcGlobal128, i32 16) | |
86 ; DUMP-NEXT: %dest10 = load <4 x i32>, <4 x i32>* @srcGlobal128, align 4 | |
87 ; DUMP-NEXT: call void @__asan_check_load(i32 %arg8, i32 1) | 29 ; DUMP-NEXT: call void @__asan_check_load(i32 %arg8, i32 1) |
88 ; DUMP-NEXT: %dest11 = load i8, i8* %arg8, align 1 | 30 ; DUMP-NEXT: %dest11 = load i8, i8* %arg8, align 1 |
89 ; DUMP-NEXT: call void @__asan_check_load(i32 %arg16, i32 2) | 31 ; DUMP-NEXT: call void @__asan_check_load(i32 %arg16, i32 2) |
90 ; DUMP-NEXT: %dest12 = load i16, i16* %arg16, align 1 | 32 ; DUMP-NEXT: %dest12 = load i16, i16* %arg16, align 1 |
91 ; DUMP-NEXT: call void @__asan_check_load(i32 %arg32, i32 4) | 33 ; DUMP-NEXT: call void @__asan_check_load(i32 %arg32, i32 4) |
92 ; DUMP-NEXT: %dest13 = load i32, i32* %arg32, align 1 | 34 ; DUMP-NEXT: %dest13 = load i32, i32* %arg32, align 1 |
93 ; DUMP-NEXT: call void @__asan_check_load(i32 %arg64, i32 8) | 35 ; DUMP-NEXT: call void @__asan_check_load(i32 %arg64, i32 8) |
94 ; DUMP-NEXT: %dest14 = load i64, i64* %arg64, align 1 | 36 ; DUMP-NEXT: %dest14 = load i64, i64* %arg64, align 1 |
95 ; DUMP-NEXT: call void @__asan_check_load(i32 %arg128, i32 16) | 37 ; DUMP-NEXT: call void @__asan_check_load(i32 %arg128, i32 16) |
96 ; DUMP-NEXT: %dest15 = load <4 x i32>, <4 x i32>* %arg128, align 4 | 38 ; DUMP-NEXT: %dest15 = load <4 x i32>, <4 x i32>* %arg128, align 4 |
97 ; DUMP: ret void | 39 ; DUMP: ret void |
98 ; DUMP-NEXT: } | 40 ; DUMP-NEXT: } |
OLD | NEW |