diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index da99890806d..70be6718084 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -709,9 +709,9 @@ void IndVarSimplify::HandleFloatingPointIV(Loop *L, PHINode *PN) { case CmpInst::FCMP_OGE: case CmpInst::FCMP_UGE: NewPred = CmpInst::ICMP_SGE; break; case CmpInst::FCMP_OLT: - case CmpInst::FCMP_ULT: NewPred = CmpInst::ICMP_ULT; break; + case CmpInst::FCMP_ULT: NewPred = CmpInst::ICMP_SLT; break; case CmpInst::FCMP_OLE: - case CmpInst::FCMP_ULE: NewPred = CmpInst::ICMP_ULE; break; + case CmpInst::FCMP_ULE: NewPred = CmpInst::ICMP_SLE; break; } const IntegerType *Int32Ty = Type::getInt32Ty(PN->getContext()); diff --git a/test/Transforms/IndVarSimplify/floating-point-iv.ll b/test/Transforms/IndVarSimplify/floating-point-iv.ll index 8d758467cb5..daeeaad8af7 100644 --- a/test/Transforms/IndVarSimplify/floating-point-iv.ll +++ b/test/Transforms/IndVarSimplify/floating-point-iv.ll @@ -41,10 +41,10 @@ entry: br label %bb bb: ; preds = %bb, %entry - %x.0.reg2mem.0 = phi double [ 0.000000e+00, %entry ], [ %1, %bb ] ; [#uses=2] - %0 = tail call i32 @foo(double %x.0.reg2mem.0) nounwind ; [#uses=0] - %1 = fadd double %x.0.reg2mem.0, 1.000000e+00 ; [#uses=2] - %2 = fcmp olt double %1, -1.000000e+00 ; [#uses=1] + %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 br i1 %2, label %bb, label %return return: ; preds = %bb @@ -70,4 +70,23 @@ return: ; preds = %bb ; CHECK: icmp } +; PR6761 +define void @test5() nounwind { +;