2010-04-03 06:27:56 +00:00
|
|
|
; RUN: opt < %s -indvars -S | FileCheck %s
|
|
|
|
define void @test1() nounwind {
|
2008-11-03 18:32:19 +00:00
|
|
|
entry:
|
|
|
|
br label %bb
|
|
|
|
|
|
|
|
bb: ; preds = %bb, %entry
|
|
|
|
%x.0.reg2mem.0 = phi double [ 0.000000e+00, %entry ], [ %1, %bb ] ; <double> [#uses=2]
|
|
|
|
%0 = tail call i32 @foo(double %x.0.reg2mem.0) nounwind ; <i32> [#uses=0]
|
2009-06-04 22:49:04 +00:00
|
|
|
%1 = fadd double %x.0.reg2mem.0, 1.000000e+00 ; <double> [#uses=2]
|
2008-11-03 18:32:19 +00:00
|
|
|
%2 = fcmp olt double %1, 1.000000e+04 ; <i1> [#uses=1]
|
|
|
|
br i1 %2, label %bb, label %return
|
|
|
|
|
|
|
|
return: ; preds = %bb
|
|
|
|
ret void
|
2013-07-14 01:42:54 +00:00
|
|
|
; CHECK-LABEL: @test1(
|
2010-04-03 06:27:56 +00:00
|
|
|
; CHECK: icmp
|
2008-11-03 18:32:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
declare i32 @foo(double)
|
2008-11-17 23:27:13 +00:00
|
|
|
|
2010-04-03 06:27:56 +00:00
|
|
|
define void @test2() nounwind {
|
2008-11-17 23:27:13 +00:00
|
|
|
entry:
|
|
|
|
br label %bb
|
|
|
|
|
|
|
|
bb: ; preds = %bb, %entry
|
|
|
|
%x.0.reg2mem.0 = phi double [ -10.000000e+00, %entry ], [ %1, %bb ] ; <double> [#uses=2]
|
|
|
|
%0 = tail call i32 @foo(double %x.0.reg2mem.0) nounwind ; <i32> [#uses=0]
|
2009-06-04 22:49:04 +00:00
|
|
|
%1 = fadd double %x.0.reg2mem.0, 2.000000e+00 ; <double> [#uses=2]
|
2008-11-17 23:27:13 +00:00
|
|
|
%2 = fcmp olt double %1, -1.000000e+00 ; <i1> [#uses=1]
|
|
|
|
br i1 %2, label %bb, label %return
|
|
|
|
|
|
|
|
return: ; preds = %bb
|
|
|
|
ret void
|
2013-07-14 01:42:54 +00:00
|
|
|
; CHECK-LABEL: @test2(
|
2010-04-03 06:27:56 +00:00
|
|
|
; CHECK: icmp
|
2008-11-17 23:27:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-03 06:27:56 +00:00
|
|
|
define void @test3() nounwind {
|
2008-11-17 23:27:13 +00:00
|
|
|
entry:
|
|
|
|
br label %bb
|
|
|
|
|
|
|
|
bb: ; preds = %bb, %entry
|
2010-04-03 06:30:03 +00:00
|
|
|
%x.0.reg2mem.0 = phi double [ 0.000000e+00, %entry ], [ %1, %bb ]
|
|
|
|
%0 = tail call i32 @foo(double %x.0.reg2mem.0) nounwind
|
|
|
|
%1 = fadd double %x.0.reg2mem.0, 1.000000e+00
|
|
|
|
%2 = fcmp olt double %1, -1.000000e+00
|
2008-11-17 23:27:13 +00:00
|
|
|
br i1 %2, label %bb, label %return
|
|
|
|
|
2010-04-03 07:18:48 +00:00
|
|
|
return:
|
2008-11-17 23:27:13 +00:00
|
|
|
ret void
|
2013-07-14 01:42:54 +00:00
|
|
|
; CHECK-LABEL: @test3(
|
2010-04-03 07:18:48 +00:00
|
|
|
; CHECK: fcmp
|
2008-11-17 23:27:13 +00:00
|
|
|
}
|
|
|
|
|
2010-04-03 06:27:56 +00:00
|
|
|
define void @test4() nounwind {
|
2008-11-17 23:27:13 +00:00
|
|
|
entry:
|
|
|
|
br label %bb
|
|
|
|
|
|
|
|
bb: ; preds = %bb, %entry
|
|
|
|
%x.0.reg2mem.0 = phi double [ 40.000000e+00, %entry ], [ %1, %bb ] ; <double> [#uses=2]
|
|
|
|
%0 = tail call i32 @foo(double %x.0.reg2mem.0) nounwind ; <i32> [#uses=0]
|
2009-06-04 22:49:04 +00:00
|
|
|
%1 = fadd double %x.0.reg2mem.0, -1.000000e+00 ; <double> [#uses=2]
|
2008-11-17 23:27:13 +00:00
|
|
|
%2 = fcmp olt double %1, 1.000000e+00 ; <i1> [#uses=1]
|
|
|
|
br i1 %2, label %bb, label %return
|
|
|
|
|
2010-04-03 07:18:48 +00:00
|
|
|
return:
|
2008-11-17 23:27:13 +00:00
|
|
|
ret void
|
2013-07-14 01:42:54 +00:00
|
|
|
; CHECK-LABEL: @test4(
|
2011-09-13 01:59:32 +00:00
|
|
|
; CHECK-NOT: cmp
|
|
|
|
; CHECK: br i1 false
|
2008-11-17 23:27:13 +00:00
|
|
|
}
|
|
|
|
|
2010-04-03 06:30:03 +00:00
|
|
|
; PR6761
|
|
|
|
define void @test5() nounwind {
|
|
|
|
; <label>:0
|
|
|
|
br label %1
|
|
|
|
|
|
|
|
; <label>:1 ; preds = %1, %0
|
|
|
|
%2 = phi double [ 9.000000e+00, %0 ], [ %4, %1 ] ; <double> [#uses=1]
|
|
|
|
%3 = tail call i32 @foo(double 0.0) ; <i32> [#uses=0]
|
|
|
|
%4 = fadd double %2, -1.000000e+00 ; <double> [#uses=2]
|
|
|
|
%5 = fcmp ult double %4, 0.000000e+00 ; <i1> [#uses=1]
|
|
|
|
br i1 %5, label %exit, label %1
|
|
|
|
|
|
|
|
exit:
|
|
|
|
ret void
|
2011-09-13 01:59:32 +00:00
|
|
|
|
2013-07-14 01:42:54 +00:00
|
|
|
; CHECK-LABEL: @test5(
|
2011-09-15 20:58:37 +00:00
|
|
|
; CHECK: icmp slt i32 {{.*}}, 0
|
2010-04-03 06:30:03 +00:00
|
|
|
; CHECK-NEXT: br i1
|
|
|
|
}
|