Home | History | Annotate | Download | only in IndVarSimplify
      1 ; RUN: opt < %s -indvars -S | FileCheck %s
      2 define void @test1() nounwind {
      3 entry:
      4 	br label %bb
      5 
      6 bb:		; preds = %bb, %entry
      7 	%x.0.reg2mem.0 = phi double [ 0.000000e+00, %entry ], [ %1, %bb ]		; <double> [#uses=2]
      8 	%0 = tail call i32 @foo(double %x.0.reg2mem.0) nounwind		; <i32> [#uses=0]
      9 	%1 = fadd double %x.0.reg2mem.0, 1.000000e+00		; <double> [#uses=2]
     10 	%2 = fcmp olt double %1, 1.000000e+04		; <i1> [#uses=1]
     11 	br i1 %2, label %bb, label %return
     12 
     13 return:		; preds = %bb
     14 	ret void
     15 ; CHECK: @test1
     16 ; CHECK: icmp
     17 }
     18 
     19 declare i32 @foo(double)
     20 
     21 define void @test2() nounwind {
     22 entry:
     23 	br label %bb
     24 
     25 bb:		; preds = %bb, %entry
     26 	%x.0.reg2mem.0 = phi double [ -10.000000e+00, %entry ], [ %1, %bb ]		; <double> [#uses=2]
     27 	%0 = tail call i32 @foo(double %x.0.reg2mem.0) nounwind		; <i32> [#uses=0]
     28 	%1 = fadd double %x.0.reg2mem.0, 2.000000e+00		; <double> [#uses=2]
     29 	%2 = fcmp olt double %1, -1.000000e+00		; <i1> [#uses=1]
     30 	br i1 %2, label %bb, label %return
     31 
     32 return:		; preds = %bb
     33 	ret void
     34 ; CHECK: @test2
     35 ; CHECK: icmp
     36 }
     37 
     38 
     39 define void @test3() nounwind {
     40 entry:
     41 	br label %bb
     42 
     43 bb:		; preds = %bb, %entry
     44 	%x.0.reg2mem.0 = phi double [ 0.000000e+00, %entry ], [ %1, %bb ]
     45 	%0 = tail call i32 @foo(double %x.0.reg2mem.0) nounwind
     46 	%1 = fadd double %x.0.reg2mem.0, 1.000000e+00
     47 	%2 = fcmp olt double %1, -1.000000e+00
     48 	br i1 %2, label %bb, label %return
     49 
     50 return:
     51 	ret void
     52 ; CHECK: @test3
     53 ; CHECK: fcmp
     54 }
     55 
     56 define void @test4() nounwind {
     57 entry:
     58 	br label %bb
     59 
     60 bb:		; preds = %bb, %entry
     61 	%x.0.reg2mem.0 = phi double [ 40.000000e+00, %entry ], [ %1, %bb ]		; <double> [#uses=2]
     62 	%0 = tail call i32 @foo(double %x.0.reg2mem.0) nounwind		; <i32> [#uses=0]
     63 	%1 = fadd double %x.0.reg2mem.0, -1.000000e+00		; <double> [#uses=2]
     64 	%2 = fcmp olt double %1, 1.000000e+00		; <i1> [#uses=1]
     65 	br i1 %2, label %bb, label %return
     66 
     67 return:
     68 	ret void
     69 ; CHECK: @test4
     70 ; CHECK: fcmp
     71 }
     72 
     73 ; PR6761
     74 define void @test5() nounwind {
     75 ; <label>:0
     76   br label %1
     77 
     78 ; <label>:1                                       ; preds = %1, %0
     79   %2 = phi double [ 9.000000e+00, %0 ], [ %4, %1 ] ; <double> [#uses=1]
     80   %3 = tail call i32 @foo(double 0.0)              ; <i32> [#uses=0]
     81   %4 = fadd double %2, -1.000000e+00              ; <double> [#uses=2]
     82   %5 = fcmp ult double %4, 0.000000e+00           ; <i1> [#uses=1]
     83   br i1 %5, label %exit, label %1
     84 
     85 exit:
     86   ret void
     87   
     88 ; CHECK: @test5
     89 ; CHECK: icmp eq i32 {{.*}}, 10
     90 ; CHECK-NEXT: br i1
     91 }
     92 
     93