Eric Christopher | cee313d | 2019-04-17 04:52:47 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -tailcallelim -verify-dom-info -S | FileCheck %s |
| 2 | |
| 3 | ; Don't turn this into an infinite loop, this is probably the implementation |
| 4 | ; of fabs and we expect the codegen to lower fabs. |
| 5 | ; CHECK: @fabs(double %f) |
| 6 | ; CHECK: call |
| 7 | ; CHECK: ret |
| 8 | |
| 9 | define double @fabs(double %f) { |
| 10 | entry: |
| 11 | %tmp2 = call double @fabs( double %f ) ; <double> [#uses=1] |
| 12 | ret double %tmp2 |
| 13 | } |
| 14 | |
| 15 | ; Do turn other calls into infinite loops though. |
| 16 | |
| 17 | ; CHECK-LABEL: define double @foo( |
| 18 | ; CHECK-NOT: call |
| 19 | ; CHECK: } |
| 20 | define double @foo(double %f) { |
| 21 | %t= call double @foo(double %f) |
| 22 | ret double %t |
| 23 | } |
| 24 | |
| 25 | ; CHECK-LABEL: define float @fabsf( |
| 26 | ; CHECK-NOT: call |
| 27 | ; CHECK: } |
| 28 | define float @fabsf(float %f) { |
| 29 | %t= call float @fabsf(float 2.0) |
| 30 | ret float %t |
| 31 | } |
| 32 | |
| 33 | declare x86_fp80 @fabsl(x86_fp80 %f) |
| 34 | |
| 35 | ; Don't crash while transforming a function with infinite recursion. |
| 36 | define i32 @PR22704(i1 %bool) { |
| 37 | entry: |
| 38 | br i1 %bool, label %t, label %f |
| 39 | |
| 40 | t: |
| 41 | %call1 = call i32 @PR22704(i1 1) |
| 42 | br label %return |
| 43 | |
| 44 | f: |
| 45 | %call = call i32 @PR22704(i1 1) |
| 46 | br label %return |
| 47 | |
| 48 | return: |
| 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 | } |