1; RUN: opt < %s -basicaa -tailcallelim -inline -instcombine -dse -S | FileCheck %s 2; PR7272 3 4; Calls that capture byval parameters cannot be marked as tail calls. Other 5; tails that don't capture byval parameters can still be tail calls. 6 7target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32" 8target triple = "i386-pc-linux-gnu" 9 10declare void @ext(i32*) 11 12define void @bar(i32* byval %x) { 13 call void @ext(i32* %x) 14 ret void 15} 16 17define void @foo(i32* %x) { 18; CHECK-LABEL: define void @foo( 19; CHECK: llvm.lifetime.start 20; CHECK: store i32 %2, i32* %x 21 call void @bar(i32* byval %x) 22 ret void 23} 24 25define internal void @qux(i32* byval %x) { 26 call void @ext(i32* %x) 27 tail call void @ext(i32* null) 28 ret void 29} 30 31define void @frob(i32* %x) { 32; CHECK-LABEL: define void @frob( 33; CHECK: %[[POS:.*]] = alloca i32 34; CHECK: %[[VAL:.*]] = load i32, i32* %x 35; CHECK: store i32 %[[VAL]], i32* %[[POS]] 36; CHECK: {{^ *}}call void @ext(i32* nonnull %[[POS]] 37; CHECK: tail call void @ext(i32* null) 38; CHECK: ret void 39 tail call void @qux(i32* byval %x) 40 ret void 41} 42