1 ; Test that HWASan remove writeonly and memory(*) attributes from instrumented functions.
2 ; RUN: opt -S -passes=hwasan %s | FileCheck %s
4 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32"
5 target triple = "aarch64-unknown-linux-android30"
7 ; CHECK: define dso_local void @test_writeonly(ptr noundef captures(none) %p) local_unnamed_addr #0
8 define dso_local void @test_writeonly(ptr noundef writeonly captures(none) %p) local_unnamed_addr #0 {
10 store i32 42, ptr %p, align 4
14 ; CHECK: define dso_local void @test_readonly(ptr noundef readonly captures(none) %p) local_unnamed_addr #0
15 define dso_local void @test_readonly(ptr noundef readonly captures(none) %p) local_unnamed_addr #1 {
17 store i32 42, ptr %p, align 4
21 ; CHECK: attributes #0 = { nobuiltin sanitize_hwaddress uwtable }
22 attributes #0 = { sanitize_hwaddress memory(argmem: write) uwtable }
23 attributes #1 = { sanitize_hwaddress memory(argmem: read) uwtable }