blob: d486f91e9c01fba173a420d49ef212d219e603b9 [file] [log] [blame]
Thomas Livelybdb912f2016-06-16 11:03:15 -07001; Test for a call to __asan_check() preceding stores
2
3; REQUIRES: allow_dump
4
5; RUN: %p2i -i %s --args -verbose=inst -threads=0 -fsanitize-address \
6; RUN: | FileCheck --check-prefix=DUMP %s
7
Thomas Livelybdb912f2016-06-16 11:03:15 -07008; A function with a local variable that does the stores
Thomas Livelyac27c512016-07-26 11:47:40 -07009define internal void @doStores(<4 x i32> %vecSrc, i32 %arg8, i32 %arg16,
10 i32 %arg32, i32 %arg64, i32 %arg128) {
11 %destLocal8 = inttoptr i32 %arg8 to i8*
12 %destLocal16 = inttoptr i32 %arg16 to i16*
13 %destLocal32 = inttoptr i32 %arg32 to i32*
14 %destLocal64 = inttoptr i32 %arg64 to i64*
15 %destLocal128 = inttoptr i32 %arg128 to <4 x i32>*
Thomas Livelybdb912f2016-06-16 11:03:15 -070016
Thomas Livelyac27c512016-07-26 11:47:40 -070017 store i8 42, i8* %destLocal8, align 1
18 store i16 42, i16* %destLocal16, align 1
19 store i32 42, i32* %destLocal32, align 1
20 store i64 42, i64* %destLocal64, align 1
21 store <4 x i32> %vecSrc, <4 x i32>* %destLocal128, align 4
Thomas Livelybdb912f2016-06-16 11:03:15 -070022
23 ret void
24}
25
26; DUMP-LABEL: ================ Instrumented CFG ================
Thomas Livelyac27c512016-07-26 11:47:40 -070027; DUMP-NEXT: define internal void @doStores(
Thomas Livelybdb912f2016-06-16 11:03:15 -070028; DUMP-NEXT: __0:
Thomas Livelyac27c512016-07-26 11:47:40 -070029; DUMP-NEXT: call void @__asan_check_store(i32 %arg8, i32 1)
30; DUMP-NEXT: store i8 42, i8* %arg8, align 1
31; DUMP-NEXT: call void @__asan_check_store(i32 %arg16, i32 2)
32; DUMP-NEXT: store i16 42, i16* %arg16, align 1
33; DUMP-NEXT: call void @__asan_check_store(i32 %arg32, i32 4)
34; DUMP-NEXT: store i32 42, i32* %arg32, align 1
35; DUMP-NEXT: call void @__asan_check_store(i32 %arg64, i32 8)
36; DUMP-NEXT: store i64 42, i64* %arg64, align 1
37; DUMP-NEXT: call void @__asan_check_store(i32 %arg128, i32 16)
38; DUMP-NEXT: store <4 x i32> %vecSrc, <4 x i32>* %arg128, align 4
Thomas Lively1fd80c72016-06-27 14:47:21 -070039; DUMP: ret void
Thomas Livelybdb912f2016-06-16 11:03:15 -070040; DUMP-NEXT: }