OLD | NEW |
1 ; Test for a call to __asan_check() preceding stores | 1 ; Test for a call to __asan_check() preceding stores |
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 ; A global to store data to | |
9 @destGlobal8 = internal global [1 x i8] zeroinitializer | |
10 @destGlobal16 = internal global [2 x i8] zeroinitializer | |
11 @destGlobal32 = internal global [4 x i8] zeroinitializer | |
12 @destGlobal64 = internal global [8 x i8] zeroinitializer | |
13 @destGlobal128 = internal global [16 x i8] zeroinitializer | |
14 | |
15 ; A function with a local variable that does the stores | 8 ; A function with a local variable that does the stores |
16 define internal void @doStores(<4 x i32> %vecSrc, i32 %arg8, i32 %arg16, | 9 define internal void @doStores(<4 x i32> %vecSrc, i32 %arg8, i32 %arg16, |
17 i32 %arg32, i32 %arg64, i32 %arg128) { | 10 i32 %arg32, i32 %arg64, i32 %arg128) { |
18 %destLocal8 = inttoptr i32 %arg8 to i8* | 11 %destLocal8 = inttoptr i32 %arg8 to i8* |
19 %destLocal16 = inttoptr i32 %arg16 to i16* | 12 %destLocal16 = inttoptr i32 %arg16 to i16* |
20 %destLocal32 = inttoptr i32 %arg32 to i32* | 13 %destLocal32 = inttoptr i32 %arg32 to i32* |
21 %destLocal64 = inttoptr i32 %arg64 to i64* | 14 %destLocal64 = inttoptr i32 %arg64 to i64* |
22 %destLocal128 = inttoptr i32 %arg128 to <4 x i32>* | 15 %destLocal128 = inttoptr i32 %arg128 to <4 x i32>* |
23 | 16 |
24 %ptrGlobal8 = bitcast [1 x i8]* @destGlobal8 to i8* | |
25 %ptrGlobal16 = bitcast [2 x i8]* @destGlobal16 to i16* | |
26 %ptrGlobal32 = bitcast [4 x i8]* @destGlobal32 to i32* | |
27 %ptrGlobal64 = bitcast [8 x i8]* @destGlobal64 to i64* | |
28 %ptrGlobal128 = bitcast [16 x i8]* @destGlobal128 to <4 x i32>* | |
29 | |
30 store i8 42, i8* %ptrGlobal8, align 1 | |
31 store i16 42, i16* %ptrGlobal16, align 1 | |
32 store i32 42, i32* %ptrGlobal32, align 1 | |
33 store i64 42, i64* %ptrGlobal64, align 1 | |
34 store <4 x i32> %vecSrc, <4 x i32>* %ptrGlobal128, align 4 | |
35 | |
36 store i8 42, i8* %destLocal8, align 1 | 17 store i8 42, i8* %destLocal8, align 1 |
37 store i16 42, i16* %destLocal16, align 1 | 18 store i16 42, i16* %destLocal16, align 1 |
38 store i32 42, i32* %destLocal32, align 1 | 19 store i32 42, i32* %destLocal32, align 1 |
39 store i64 42, i64* %destLocal64, align 1 | 20 store i64 42, i64* %destLocal64, align 1 |
40 store <4 x i32> %vecSrc, <4 x i32>* %destLocal128, align 4 | 21 store <4 x i32> %vecSrc, <4 x i32>* %destLocal128, align 4 |
41 | 22 |
42 ret void | 23 ret void |
43 } | 24 } |
44 | 25 |
45 ; DUMP-LABEL: ================ Instrumented CFG ================ | 26 ; DUMP-LABEL: ================ Instrumented CFG ================ |
46 ; DUMP-NEXT: define internal void @doStores( | 27 ; DUMP-NEXT: define internal void @doStores( |
47 ; DUMP-NEXT: __0: | 28 ; DUMP-NEXT: __0: |
48 ; DUMP-NEXT: call void @__asan_check_store(i32 @destGlobal8, i32 1) | |
49 ; DUMP-NEXT: store i8 42, i8* @destGlobal8, align 1 | |
50 ; DUMP-NEXT: call void @__asan_check_store(i32 @destGlobal16, i32 2) | |
51 ; DUMP-NEXT: store i16 42, i16* @destGlobal16, align 1 | |
52 ; DUMP-NEXT: call void @__asan_check_store(i32 @destGlobal32, i32 4) | |
53 ; DUMP-NEXT: store i32 42, i32* @destGlobal32, align 1 | |
54 ; DUMP-NEXT: call void @__asan_check_store(i32 @destGlobal64, i32 8) | |
55 ; DUMP-NEXT: store i64 42, i64* @destGlobal64, align 1 | |
56 ; DUMP-NEXT: call void @__asan_check_store(i32 @destGlobal128, i32 16) | |
57 ; DUMP-NEXT: store <4 x i32> %vecSrc, <4 x i32>* @destGlobal128, align 4 | |
58 ; DUMP-NEXT: call void @__asan_check_store(i32 %arg8, i32 1) | 29 ; DUMP-NEXT: call void @__asan_check_store(i32 %arg8, i32 1) |
59 ; DUMP-NEXT: store i8 42, i8* %arg8, align 1 | 30 ; DUMP-NEXT: store i8 42, i8* %arg8, align 1 |
60 ; DUMP-NEXT: call void @__asan_check_store(i32 %arg16, i32 2) | 31 ; DUMP-NEXT: call void @__asan_check_store(i32 %arg16, i32 2) |
61 ; DUMP-NEXT: store i16 42, i16* %arg16, align 1 | 32 ; DUMP-NEXT: store i16 42, i16* %arg16, align 1 |
62 ; DUMP-NEXT: call void @__asan_check_store(i32 %arg32, i32 4) | 33 ; DUMP-NEXT: call void @__asan_check_store(i32 %arg32, i32 4) |
63 ; DUMP-NEXT: store i32 42, i32* %arg32, align 1 | 34 ; DUMP-NEXT: store i32 42, i32* %arg32, align 1 |
64 ; DUMP-NEXT: call void @__asan_check_store(i32 %arg64, i32 8) | 35 ; DUMP-NEXT: call void @__asan_check_store(i32 %arg64, i32 8) |
65 ; DUMP-NEXT: store i64 42, i64* %arg64, align 1 | 36 ; DUMP-NEXT: store i64 42, i64* %arg64, align 1 |
66 ; DUMP-NEXT: call void @__asan_check_store(i32 %arg128, i32 16) | 37 ; DUMP-NEXT: call void @__asan_check_store(i32 %arg128, i32 16) |
67 ; DUMP-NEXT: store <4 x i32> %vecSrc, <4 x i32>* %arg128, align 4 | 38 ; DUMP-NEXT: store <4 x i32> %vecSrc, <4 x i32>* %arg128, align 4 |
68 ; DUMP: ret void | 39 ; DUMP: ret void |
69 ; DUMP-NEXT: } | 40 ; DUMP-NEXT: } |
OLD | NEW |