blob: 67ddac73de548c9c0fc0244c77342cae90888422 [file] [log] [blame]
Evgeniy Stepanovc667c1f2017-12-09 00:21:41 +00001; Test basic address sanitizer instrumentation.
2;
3; RUN: opt < %s -hwasan -S | FileCheck %s
4
5target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
6target triple = "aarch64--linux-android"
7
8define void @atomicrmw(i64* %ptr) sanitize_hwaddress {
9; CHECK-LABEL: @atomicrmw(
10; CHECK: %[[A:[^ ]*]] = ptrtoint i64* %ptr to i64
11; CHECK: call void @__hwasan_store8(i64 %[[A]])
12
13entry:
14 %0 = atomicrmw add i64* %ptr, i64 1 seq_cst
15 ret void
16}
17
18define void @cmpxchg(i64* %ptr, i64 %compare_to, i64 %new_value) sanitize_hwaddress {
19; CHECK-LABEL: @cmpxchg(
20; CHECK: %[[A:[^ ]*]] = ptrtoint i64* %ptr to i64
21; CHECK: call void @__hwasan_store8(i64 %[[A]])
22
23entry:
24 %0 = cmpxchg i64* %ptr, i64 %compare_to, i64 %new_value seq_cst seq_cst
25 ret void
26}