xref: /llvm-project/llvm/test/Instrumentation/HWAddressSanitizer/mem-attr.ll (revision 29441e4f5fa5f5c7709f7cf180815ba97f611297)
1; Test that HWASan remove writeonly and memory(*) attributes from instrumented functions.
2; RUN: opt -S -passes=hwasan %s | FileCheck %s
3
4target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32"
5target triple = "aarch64-unknown-linux-android30"
6
7; CHECK: define dso_local void @test_writeonly(ptr noundef captures(none) %p) local_unnamed_addr #0
8define dso_local void @test_writeonly(ptr noundef writeonly captures(none) %p) local_unnamed_addr #0 {
9entry:
10  store i32 42, ptr %p, align 4
11  ret void
12}
13
14; CHECK: define dso_local void @test_readonly(ptr noundef readonly captures(none) %p) local_unnamed_addr #0
15define dso_local void @test_readonly(ptr noundef readonly captures(none) %p) local_unnamed_addr #1 {
16entry:
17  store i32 42, ptr %p, align 4
18  ret void
19}
20
21; CHECK: attributes #0 = { nobuiltin sanitize_hwaddress uwtable }
22attributes #0 = { sanitize_hwaddress memory(argmem: write) uwtable }
23attributes #1 = { sanitize_hwaddress memory(argmem: read) uwtable }
24