Evgeniy Stepanov | c667c1f | 2017-12-09 00:21:41 +0000 | [diff] [blame^] | 1 | ; Test basic address sanitizer instrumentation. |
| 2 | ; |
| 3 | ; RUN: opt < %s -hwasan -S | FileCheck %s |
| 4 | |
| 5 | target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" |
| 6 | target triple = "aarch64--linux-android" |
| 7 | |
| 8 | define 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 | |
| 13 | entry: |
| 14 | %0 = atomicrmw add i64* %ptr, i64 1 seq_cst |
| 15 | ret void |
| 16 | } |
| 17 | |
| 18 | define 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 | |
| 23 | entry: |
| 24 | %0 = cmpxchg i64* %ptr, i64 %compare_to, i64 %new_value seq_cst seq_cst |
| 25 | ret void |
| 26 | } |