xref: /llvm-project/llvm/test/Instrumentation/MemorySanitizer/attributes.ll (revision 21c3df4b858476bbc9b2b5af96cfef41f5715715)
1; RUN: opt < %s -S -passes='module(msan)' 2>&1 | FileCheck %s
2
3target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
4target triple = "x86_64-unknown-linux-gnu"
5
6
7declare void @a_() sanitize_memory readnone
8declare void @b_() sanitize_memory readonly
9declare void @c_() sanitize_memory writeonly
10declare void @d_(ptr %p) sanitize_memory writeonly argmemonly
11declare void @e_() sanitize_memory speculatable
12
13define void @a() sanitize_memory readnone {
14entry:
15  call void @a_()
16  call void @a_() readnone
17  ret void
18}
19
20define void @b() sanitize_memory readonly {
21entry:
22  call void @b_()
23  call void @b_() readonly
24  ret void
25}
26
27define void @c() sanitize_memory writeonly {
28entry:
29  call void @c_()
30  call void @c_() writeonly
31  ret void
32}
33
34define void @d(ptr %p) sanitize_memory writeonly argmemonly {
35entry:
36  call void @d_(ptr %p)
37  call void @d_(ptr %p) writeonly argmemonly
38  ret void
39}
40
41define void @e() sanitize_memory speculatable {
42entry:
43  call void @e_()
44  ret void
45}
46
47; CHECK-NOT: memory(
48; CHECK-NOT: speculatable
49
50; CHECK: Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
51; CHECK-NEXT: declare void @llvm.donothing
52