blob: c121c25aee98dfbf2d9e13b087c04e2a70879942 [file] [log] [blame]
Dan Gohman99e53272010-04-16 15:57:50 +00001; RUN: opt < %s -tailcallelim -S | FileCheck %s
2
Chris Lattnerc75cbe62007-09-10 20:58:55 +00003; Don't turn this into an infinite loop, this is probably the implementation
4; of fabs and we expect the codegen to lower fabs.
Dan Gohman99e53272010-04-16 15:57:50 +00005; CHECK: @fabs(double %f)
6; CHECK: call
7; CHECK: ret
Chris Lattnerc75cbe62007-09-10 20:58:55 +00008
9define double @fabs(double %f) {
10entry:
11 %tmp2 = call double @fabs( double %f ) ; <double> [#uses=1]
12 ret double %tmp2
13}
14
Dan Gohman99e53272010-04-16 15:57:50 +000015; Do turn other calls into infinite loops though.
16
Stephen Lina76289a2013-07-14 01:50:49 +000017; CHECK-LABEL: define double @foo(
Dan Gohman99e53272010-04-16 15:57:50 +000018; CHECK-NOT: call
19; CHECK: }
20define double @foo(double %f) {
21 %t= call double @foo(double %f)
22 ret double %t
23}
24
Stephen Lina76289a2013-07-14 01:50:49 +000025; CHECK-LABEL: define float @fabsf(
Dan Gohman99e53272010-04-16 15:57:50 +000026; CHECK-NOT: call
27; CHECK: }
28define float @fabsf(float %f) {
29 %t= call float @fabsf(float 2.0)
30 ret float %t
31}
32
Dan Gohman99e53272010-04-16 15:57:50 +000033declare x86_fp80 @fabsl(x86_fp80 %f)
Benjamin Kramercb570f12015-02-28 16:47:27 +000034
35; Don't crash while transforming a function with infinite recursion.
36define i32 @PR22704(i1 %bool) {
37entry:
38 br i1 %bool, label %t, label %f
39
40t:
41 %call1 = call i32 @PR22704(i1 1)
42 br label %return
43
44f:
45 %call = call i32 @PR22704(i1 1)
46 br label %return
47
48return:
49 ret i32 0
50
51; CHECK-LABEL: @PR22704(
52; CHECK: %bool.tr = phi i1 [ %bool, %entry ], [ true, %t ], [ true, %f ]
53; CHECK: br i1 %bool.tr, label %t, label %f
54}