• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; 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: [[PTRI8:%[^ ]*]] = bitcast i64* %ptr to i8*
11; CHECK: call void @llvm.hwasan.check.memaccess({{.*}}, i8* [[PTRI8]], i32 19)
12; CHECK: atomicrmw add i64* %ptr, i64 1 seq_cst
13; CHECK: ret void
14
15entry:
16  %0 = atomicrmw add i64* %ptr, i64 1 seq_cst
17  ret void
18}
19
20define void @cmpxchg(i64* %ptr, i64 %compare_to, i64 %new_value) sanitize_hwaddress {
21; CHECK-LABEL: @cmpxchg(
22; CHECK: [[PTRI8:%[^ ]*]] = bitcast i64* %ptr to i8*
23; CHECK: call void @llvm.hwasan.check.memaccess({{.*}}, i8* [[PTRI8]], i32 19)
24; CHECK: cmpxchg i64* %ptr, i64 %compare_to, i64 %new_value seq_cst seq_cst
25; CHECK: ret void
26
27entry:
28  %0 = cmpxchg i64* %ptr, i64 %compare_to, i64 %new_value seq_cst seq_cst
29  ret void
30}
31