xref: /llvm-project/llvm/test/Analysis/BasicAA/noalias-param.ll (revision 05ff7606c9d47135ecf5b69e25b1327634f6fa27)
1; RUN: opt < %s -aa-pipeline=basic-aa -passes=aa-eval -print-all-alias-modref-info 2>&1 | FileCheck %s
2
3declare ptr @captures(ptr %cap) nounwind readonly
4
5; CHECK-LABEL: no
6; CHECK: NoAlias:      i32* %a, i32* %b
7define void @no(ptr noalias %a, ptr %b) nounwind {
8entry:
9  store i32 1, ptr %a
10  %cap = call ptr @captures(ptr %a) nounwind readonly
11  %l = load i32, ptr %b
12  ret void
13}
14
15; CHECK-LABEL: yes
16; CHECK: MayAlias:     i32* %c, i32* %d
17define void @yes(ptr %c, ptr %d) nounwind {
18entry:
19  store i32 1, ptr %c
20  %cap = call ptr @captures(ptr %c) nounwind readonly
21  %l = load i32, ptr %d
22  ret void
23}
24
25; Result should be the same for byval instead of noalias.
26; CHECK-LABEL: byval
27; CHECK: NoAlias: i32* %a, i32* %b
28define void @byval(ptr byval(i32) %a, ptr %b) nounwind {
29entry:
30  store i32 1, ptr %a
31  %cap = call ptr @captures(ptr %a) nounwind readonly
32  %l = load i32, ptr %b
33  ret void
34}
35