brintos

brintos / llvm-project-archived public Read only

0
0
Text · 815 B · f82df2f Raw
34 lines · plain
1; RUN: opt < %s -passes=lint -disable-output 2>&1 | FileCheck %s2 3%s = type { i8 }4 5declare void @f1(ptr)6 7define void @f2() {8entry:9  %c = alloca %s10  tail call void @f1(ptr %c)11  ret void12}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 alloca16; CHECK-NEXT:  tail call void @f1(ptr %c)17 18declare void @f3(ptr byval(%s))19 20define void @f4() {21entry:22  %c = alloca %s23  tail call void @f3(ptr byval(%s) %c)24  ret void25}26 27; Lint should not complain about passing the alloca'd %c since it's passed28; byval, effectively copying the data to the stack instead of leaking the29; pointer itself.30; CHECK-NOT: Undefined behavior: Call with "tail" keyword references alloca31; CHECK-NOT:  tail call void @f3(ptr byval(%s) %c)32 33 34