Sanjay Patel | c04b6f2 | 2015-03-11 15:12:32 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -inline -instcombine -S | FileCheck %s |
| 2 | |
| 3 | ; PR22857: http://llvm.org/bugs/show_bug.cgi?id=22857 |
| 4 | ; The inliner should not add an edge to an intrinsic and |
| 5 | ; then assert that it did not add an edge to an intrinsic! |
| 6 | |
Sanjay Patel | 683f297 | 2016-01-11 22:34:19 +0000 | [diff] [blame] | 7 | define float @foo(float %f1) { |
Sanjay Patel | c04b6f2 | 2015-03-11 15:12:32 +0000 | [diff] [blame] | 8 | %call = call float @bar(float %f1) |
| 9 | ret float %call |
| 10 | |
| 11 | ; CHECK-LABEL: @foo( |
Sanjay Patel | fa54ace | 2015-12-14 21:59:03 +0000 | [diff] [blame] | 12 | ; CHECK-NEXT: call fast float @llvm.fabs.f32 |
Sanjay Patel | c04b6f2 | 2015-03-11 15:12:32 +0000 | [diff] [blame] | 13 | ; CHECK-NEXT: ret float |
| 14 | } |
| 15 | |
Sanjay Patel | 683f297 | 2016-01-11 22:34:19 +0000 | [diff] [blame] | 16 | define float @bar(float %f1) { |
Sanjay Patel | c04b6f2 | 2015-03-11 15:12:32 +0000 | [diff] [blame] | 17 | %call = call float @sqr(float %f1) |
Sanjay Patel | 683f297 | 2016-01-11 22:34:19 +0000 | [diff] [blame] | 18 | %call1 = call fast float @sqrtf(float %call) |
Sanjay Patel | c04b6f2 | 2015-03-11 15:12:32 +0000 | [diff] [blame] | 19 | ret float %call1 |
| 20 | } |
| 21 | |
Sanjay Patel | 683f297 | 2016-01-11 22:34:19 +0000 | [diff] [blame] | 22 | define float @sqr(float %f) { |
Sanjay Patel | c04b6f2 | 2015-03-11 15:12:32 +0000 | [diff] [blame] | 23 | %mul = fmul fast float %f, %f |
| 24 | ret float %mul |
| 25 | } |
| 26 | |
Sanjay Patel | 683f297 | 2016-01-11 22:34:19 +0000 | [diff] [blame] | 27 | declare float @sqrtf(float) |
Sanjay Patel | c04b6f2 | 2015-03-11 15:12:32 +0000 | [diff] [blame] | 28 | |