Home | History | Annotate | Download | only in InstCombine
      1 ; RUN: opt < %s -instcombine -S | FileCheck %s
      2 
      3 ; CHECK: no_crash
      4 define float @no_crash(float %a) nounwind {
      5 entry:
      6   br label %for.body
      7 
      8 for.body:
      9   %sum.057 = phi float [ 0.000000e+00, %entry ], [ %add5, %bb0 ]
     10   %add5 = fadd float %sum.057, %a    ; PR14592
     11   br i1 undef, label %bb0, label %end
     12 
     13 bb0:
     14   br label %for.body
     15 
     16 end:
     17   ret float %add5
     18 }
     19 
     20 ; CHECK: fold_phi
     21 define float @fold_phi(float %a) nounwind {
     22 entry:
     23   br label %for.body
     24 
     25 for.body:
     26 ; CHECK: phi float
     27 ; CHECK-NEXT: br i1 undef
     28   %sum.057 = phi float [ 0.000000e+00, %entry ], [ %add5, %bb0 ]
     29   %add5 = fadd float %sum.057, 1.0 ;; Should be moved to the latch!
     30   br i1 undef, label %bb0, label %end
     31 
     32 ; CHECK: bb0:
     33 bb0:
     34 ; CHECK: fadd float
     35   br label %for.body
     36 
     37 end:
     38   ret float %add5
     39 }
     40