1; RUN: opt < %s -passes=lint -disable-output 2>&1 | FileCheck %s
2
3declare void @f1(i8* noalias readonly, i8*)
4
5define void @f2(i8* %a) {
6entry:
7  call void @f1(i8* %a, i8* %a)
8  ret void
9}
10
11; Lint should complain about us passing %a to both arguments, since the noalias
12; argument may depend on writes to the other.
13; CHECK: Unusual: noalias argument aliases another argument
14; CHECK-NEXT: call void @f1(i8* %a, i8* %a)
15
16declare void @f3(i8* noalias, i8* readonly)
17
18define void @f4(i8* %a) {
19entry:
20  call void @f3(i8* %a, i8* %a)
21  ret void
22}
23
24; Lint should complain about us passing %a to both arguments, since writes to
25; the noalias argument may cause a dependency for the other.
26; CHECK: Unusual: noalias argument aliases another argument
27; CHECK-NEXT: call void @f3(i8* %a, i8* %a)
28
29declare void @f5(i8* noalias readonly, i8* readonly)
30
31define void @f6(i8* %a) {
32entry:
33  call void @f5(i8* %a, i8* %a)
34  ret void
35}
36
37; Lint should not complain about passing %a to both arguments even if one is
38; noalias, since they are both readonly and thus have no dependence.
39; CHECK-NOT: Unusual: noalias argument aliases another argument
40; CHECK-NOT: call void @f5(i8* %a, i8* %a)
41