1 ; RUN: opt -S -hwasan < %s | FileCheck %s
3 target triple = "aarch64--linux-android"
5 declare i32 @bar([16 x i32]* %p)
7 define void @alloca() sanitize_hwaddress "hwasan-abi"="interceptor" {
8 ; CHECK: alloca [16 x i32]
9 ; CHECK: [[A:%[^ ]*]] = call i8* @llvm.thread.pointer()
10 ; CHECK: [[B:%[^ ]*]] = getelementptr i8, i8* [[A]], i32 48
11 ; CHECK: [[C:%[^ ]*]] = bitcast i8* [[B]] to i64*
12 ; CHECK: [[LOAD:%[^ ]*]] = load i64, i64* [[C]]
13 ; CHECK: [[ICMP:%[^ ]*]] = icmp eq i64 [[LOAD]], 0
14 ; CHECK: br i1 [[ICMP]], label %[[INIT:[^,]*]], label %[[CONT:[^,]*]], !prof [[PROF:![0-9]+]]
17 ; CHECK: call void @__hwasan_thread_enter()
18 ; CHECK: [[RELOAD:%[^ ]*]] = load i64, i64* [[C]]
19 ; CHECK: br label %[[CONT]]
22 ; CHECK: phi i64 [ [[LOAD]], %0 ], [ [[RELOAD]], %[[INIT]] ]
25 %p = alloca [16 x i32]
26 %size = call i32 @bar([16 x i32]* %p)
27 %q = alloca i8, i32 %size
31 define i32 @load(i32* %p) sanitize_hwaddress "hwasan-abi"="interceptor" {
32 ; CHECK: [[SHADOW:%[^ ]*]] = call i8* asm "", "=r,0"([0 x i8]* @__hwasan_shadow)
34 ; CHECK: call void @llvm.hwasan.check.memaccess(i8* [[SHADOW]],
35 %v = load i32, i32* %p
39 ; CHECK: [[PROF]] = !{!"branch_weights", i32 1, i32 100000}