; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -indvars -S | FileCheck %s define void @test1() nounwind { ; CHECK-LABEL: @test1( ; CHECK-NEXT: entry: ; CHECK-NEXT: br label [[BB:%.*]] ; CHECK: bb: ; CHECK-NEXT: [[IV_INT:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[DOTINT:%.*]], [[BB]] ] ; CHECK-NEXT: [[INDVAR_CONV:%.*]] = sitofp i32 [[IV_INT]] to double ; CHECK-NEXT: [[TMP0:%.*]] = tail call i32 @foo(double [[INDVAR_CONV]]) [[ATTR0:#.*]] ; CHECK-NEXT: [[DOTINT]] = add nuw nsw i32 [[IV_INT]], 1 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ult i32 [[DOTINT]], 10000 ; CHECK-NEXT: br i1 [[TMP1]], label [[BB]], label [[RETURN:%.*]] ; CHECK: return: ; CHECK-NEXT: ret void ; entry: br label %bb bb: ; preds = %bb, %entry %iv = phi double [ 0.000000e+00, %entry ], [ %1, %bb ] %0 = tail call i32 @foo(double %iv) nounwind %1 = fadd double %iv, 1.000000e+00 %2 = fcmp olt double %1, 1.000000e+04 br i1 %2, label %bb, label %return return: ; preds = %bb ret void } declare i32 @foo(double) define void @test2() nounwind { ; CHECK-LABEL: @test2( ; CHECK-NEXT: entry: ; CHECK-NEXT: br label [[BB:%.*]] ; CHECK: bb: ; CHECK-NEXT: [[IV_INT:%.*]] = phi i32 [ -10, [[ENTRY:%.*]] ], [ [[DOTINT:%.*]], [[BB]] ] ; CHECK-NEXT: [[INDVAR_CONV:%.*]] = sitofp i32 [[IV_INT]] to double ; CHECK-NEXT: [[TMP0:%.*]] = tail call i32 @foo(double [[INDVAR_CONV]]) [[ATTR0]] ; CHECK-NEXT: [[DOTINT]] = add nsw i32 [[IV_INT]], 2 ; CHECK-NEXT: [[TMP1:%.*]] = icmp slt i32 [[DOTINT]], -1 ; CHECK-NEXT: br i1 [[TMP1]], label [[BB]], label [[RETURN:%.*]] ; CHECK: return: ; CHECK-NEXT: ret void ; entry: br label %bb bb: ; preds = %bb, %entry %iv = phi double [ -10.000000e+00, %entry ], [ %1, %bb ] %0 = tail call i32 @foo(double %iv) nounwind %1 = fadd double %iv, 2.000000e+00 %2 = fcmp olt double %1, -1.000000e+00 br i1 %2, label %bb, label %return return: ; preds = %bb ret void } define void @test3() nounwind { ; CHECK-LABEL: @test3( ; CHECK-NEXT: entry: ; CHECK-NEXT: br label [[BB:%.*]] ; CHECK: bb: ; CHECK-NEXT: [[IV:%.*]] = phi double [ 0.000000e+00, [[ENTRY:%.*]] ], [ [[TMP1:%.*]], [[BB]] ] ; CHECK-NEXT: [[TMP0:%.*]] = tail call i32 @foo(double [[IV]]) [[ATTR0]] ; CHECK-NEXT: [[TMP1]] = fadd double [[IV]], 1.000000e+00 ; CHECK-NEXT: br i1 false, label [[BB]], label [[RETURN:%.*]] ; CHECK: return: ; CHECK-NEXT: ret void ; entry: br label %bb bb: ; preds = %bb, %entry %iv = phi double [ 0.000000e+00, %entry ], [ %1, %bb ] %0 = tail call i32 @foo(double %iv) nounwind %1 = fadd double %iv, 1.000000e+00 %2 = fcmp olt double %1, -1.000000e+00 br i1 %2, label %bb, label %return return: ret void } define void @test4() nounwind { ; CHECK-LABEL: @test4( ; CHECK-NEXT: entry: ; CHECK-NEXT: br label [[BB:%.*]] ; CHECK: bb: ; CHECK-NEXT: [[IV_INT:%.*]] = phi i32 [ 40, [[ENTRY:%.*]] ], [ [[DOTINT:%.*]], [[BB]] ] ; CHECK-NEXT: [[INDVAR_CONV:%.*]] = sitofp i32 [[IV_INT]] to double ; CHECK-NEXT: [[TMP0:%.*]] = tail call i32 @foo(double [[INDVAR_CONV]]) [[ATTR0]] ; CHECK-NEXT: [[DOTINT]] = add nsw i32 [[IV_INT]], -1 ; CHECK-NEXT: br i1 false, label [[BB]], label [[RETURN:%.*]] ; CHECK: return: ; CHECK-NEXT: ret void ; entry: br label %bb bb: ; preds = %bb, %entry %iv = phi double [ 40.000000e+00, %entry ], [ %1, %bb ] %0 = tail call i32 @foo(double %iv) nounwind %1 = fadd double %iv, -1.000000e+00 %2 = fcmp olt double %1, 1.000000e+00 br i1 %2, label %bb, label %return return: ret void } ; PR6761 define void @test5() nounwind { ;