xref: /llvm-project/llvm/test/CodeGen/ARM/no-tail-call.ll (revision bed1c7f061aa12417aa081e334afdba45767b938)
1; RUN: llc < %s -O0 -o - | FileCheck %s
2target datalayout = "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
3target triple = "armv7s-apple-ios7"
4
5%foo = type <{ %Sf }>
6%Sf = type <{ float }>
7
8declare float @llvm.ceil.f32(float)
9
10; Check that we are not emitting a tail call for the last call to ceil.
11; This function returns three different results.
12; CHECK-LABEL: func1:
13; CHECK-NOT: b _ceilf
14; CHECK: pop
15define { float, float, float } @func1() {
16entry:
17  %0 = alloca %foo, align 4
18  %1 = alloca %foo, align 4
19  %2 = alloca %foo, align 4
20  store float 0.000000e+00, ptr %0, align 4
21  store float 1.000000e+00, ptr %1, align 4
22  store float 5.000000e+00, ptr %2, align 4
23  br i1 true, label %3, label %4
24
25; <label>:3                                       ; preds = %entry
26  store float 2.000000e+00, ptr %1, align 4
27  br label %4
28
29; <label>:4                                       ; preds = %3, %entry
30  %5 = call float @llvm.ceil.f32(float 5.000000e+00)
31  %6 = load float, ptr %1, align 4
32  %7 = call float @llvm.ceil.f32(float %6)
33  %8 = insertvalue { float, float, float } { float 0.000000e+00, float undef, float undef }, float %5, 1
34  %9 = insertvalue { float, float, float } %8, float %7, 2
35  ret { float, float, float } %9
36}
37
38; Check that we are not emitting a tail call for the last call to ceil.
39; This function returns two different results.
40; CHECK-LABEL: func2:
41; CHECK-NOT: b _ceilf
42; CHECK: pop
43define { float, float } @func2() {
44entry:
45  %0 = alloca %foo, align 4
46  %1 = alloca %foo, align 4
47  %2 = alloca %foo, align 4
48  store float 0.000000e+00, ptr %0, align 4
49  store float 1.000000e+00, ptr %1, align 4
50  store float 5.000000e+00, ptr %2, align 4
51  br i1 true, label %3, label %4
52
53; <label>:3                                       ; preds = %entry
54  store float 2.000000e+00, ptr %1, align 4
55  br label %4
56
57; <label>:4                                       ; preds = %3, %entry
58  %5 = call float @llvm.ceil.f32(float 5.000000e+00)
59  %6 = load float, ptr %1, align 4
60  %7 = call float @llvm.ceil.f32(float %6)
61  %8 = insertvalue { float, float } { float 0.000000e+00, float undef }, float %7, 1
62  ret { float, float } %8
63}
64
65