Home | History | Annotate | Download | only in Lint
      1 ; RUN: opt < %s -lint -disable-output 2>&1 | FileCheck %s
      2 
      3 %s = type { i8 }
      4 
      5 declare void @f1(%s*)
      6 
      7 define void @f2() {
      8 entry:
      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 
     18 declare void @f3(%s* byval)
     19 
     20 define void @f4() {
     21 entry:
     22   %c = alloca %s
     23   tail call void @f3(%s* byval %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 %c)
     32 
     33 
     34