1; 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} 21 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) { 24; CHECK-LABEL: @foo( 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} 33 34; CHECK-LABEL: @test3( 35define 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} 50