blob: 3a8906aa210f6a25dd779d2ba249961fc9137265 [file] [log] [blame]
Reid Kleckner9b2cc642014-04-21 20:48:47 +00001; RUN: opt < %s -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}
30define void @frob(i32* %x) {
31; CHECK-LABEL: define void @frob(
32; CHECK: alloca i32
33; CHECK: {{^ *}}call void @ext(
34; CHECK: tail call void @ext(i32* null)
35; CHECK: ret void
36 tail call void @qux(i32* byval %x)
37 ret void
38}