1; RUN: opt < %s -lint -disable-output 2>&1 | FileCheck %s
2
3%s = type { i8 }
4
5declare void @f1(%s*)
6
7define void @f2() {
8entry:
9  %c = alloca %s
10  tail call void @f1(%s* %c)
11  ret void
12}
13
14; Lint should complain about the tail call passing the alloca'd value %c to f1.
15; CHECK: Undefined behavior: Call with "tail" keyword references alloca
16; CHECK-NEXT:  tail call void @f1(%s* %c)
17
18declare void @f3(%s* byval(%s))
19
20define void @f4() {
21entry:
22  %c = alloca %s
23  tail call void @f3(%s* byval(%s) %c)
24  ret void
25}
26
27; Lint should not complain about passing the alloca'd %c since it's passed
28; byval, effectively copying the data to the stack instead of leaking the
29; pointer itself.
30; CHECK-NOT: Undefined behavior: Call with "tail" keyword references alloca
31; CHECK-NOT:  tail call void @f3(%s* byval(%s) %c)
32
33
34