Dale Johannesen | 16bb87a | 2010-10-27 23:45:18 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -instcombine -S | FileCheck %s |
| 2 | ; Formerly crashed, PR8490. |
| 3 | |
| 4 | define fastcc double @gimp_operation_color_balance_map(float %value, double %highlights) nounwind readnone inlinehint { |
| 5 | entry: |
| 6 | ; CHECK: gimp_operation_color_balance_map |
| 7 | ; CHECK: fsub double -0.000000 |
| 8 | %conv = fpext float %value to double |
| 9 | %div = fdiv double %conv, 1.600000e+01 |
| 10 | %add = fadd double %div, 1.000000e+00 |
| 11 | %div1 = fdiv double 1.000000e+00, %add |
| 12 | %sub = fsub double 1.075000e+00, %div1 |
| 13 | %sub24 = fsub double 1.000000e+00, %sub |
| 14 | %add26 = fadd double %sub, 1.000000e+00 |
| 15 | %cmp86 = fcmp ogt double %highlights, 0.000000e+00 |
| 16 | %cond90 = select i1 %cmp86, double %sub24, double %add26 |
| 17 | %mul91 = fmul double %highlights, %cond90 |
| 18 | %add94 = fadd double undef, %mul91 |
| 19 | ret double %add94 |
| 20 | } |
Eli Friedman | 2c980fa | 2011-06-23 20:40:23 +0000 | [diff] [blame] | 21 | |
| 22 | ; PR10180: same crash, but with vectors |
| 23 | define <4 x float> @foo(i1 %b, <4 x float> %x, <4 x float> %y, <4 x float> %z) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 24 | ; CHECK-LABEL: @foo( |
Eli Friedman | 2c980fa | 2011-06-23 20:40:23 +0000 | [diff] [blame] | 25 | ; CHECK: fsub <4 x float> |
| 26 | ; CHECK: select |
| 27 | ; CHECK: fadd <4 x float> |
| 28 | %a = fadd <4 x float> %x, %y |
| 29 | %sub = fsub <4 x float> %x, %z |
| 30 | %sel = select i1 %b, <4 x float> %a, <4 x float> %sub |
| 31 | ret <4 x float> %sel |
| 32 | } |
Nuno Lopes | 20c7eb3 | 2012-07-27 18:03:57 +0000 | [diff] [blame] | 33 | |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 34 | ; CHECK-LABEL: @test3( |
Nuno Lopes | 20c7eb3 | 2012-07-27 18:03:57 +0000 | [diff] [blame] | 35 | define i32 @test3(i1 %bool, i32 %a) { |
| 36 | entry: |
| 37 | %cond = or i1 %bool, true |
| 38 | br i1 %cond, label %return, label %xpto |
| 39 | |
| 40 | ; technically reachable, but this malformed IR may appear as a result of constant propagation |
| 41 | xpto: |
| 42 | %select = select i1 %bool, i32 %a, i32 %select |
| 43 | %select2 = select i1 %bool, i32 %select2, i32 %a |
| 44 | %sum = add i32 %select, %select2 |
| 45 | ret i32 %sum |
| 46 | |
| 47 | return: |
| 48 | ret i32 7 |
| 49 | } |