blob: 77446cd8ba0233e57b9f550b677fdf96e8210e18 [file] [log] [blame]
Dale Johannesen16bb87a2010-10-27 23:45:18 +00001; RUN: opt < %s -instcombine -S | FileCheck %s
2; Formerly crashed, PR8490.
3
4define fastcc double @gimp_operation_color_balance_map(float %value, double %highlights) nounwind readnone inlinehint {
5entry:
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 Friedman2c980fa2011-06-23 20:40:23 +000021
22; PR10180: same crash, but with vectors
23define <4 x float> @foo(i1 %b, <4 x float> %x, <4 x float> %y, <4 x float> %z) {
Stephen Linc1c7a132013-07-14 01:42:54 +000024; CHECK-LABEL: @foo(
Eli Friedman2c980fa2011-06-23 20:40:23 +000025; 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 Lopes20c7eb32012-07-27 18:03:57 +000033
Stephen Linc1c7a132013-07-14 01:42:54 +000034; CHECK-LABEL: @test3(
Nuno Lopes20c7eb32012-07-27 18:03:57 +000035define i32 @test3(i1 %bool, i32 %a) {
36entry:
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
41xpto:
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
47return:
48 ret i32 7
49}