Index: lib/Analysis/InstructionSimplify.cpp =================================================================== --- lib/Analysis/InstructionSimplify.cpp +++ lib/Analysis/InstructionSimplify.cpp @@ -3328,14 +3328,15 @@ } } } - if (CFP->getValueAPF().isZero()) { + if (CFP->getValueAPF().isZero() || + (CFP->getValueAPF().isNegative() && !CFP->getValueAPF().isNaN())) { switch (Pred) { case FCmpInst::FCMP_UGE: if (CannotBeOrderedLessThanZero(LHS, Q.TLI)) return getTrue(RetTy); break; case FCmpInst::FCMP_OLT: - // X < 0 + // X < 0 or X < -C if (CannotBeOrderedLessThanZero(LHS, Q.TLI)) return getFalse(RetTy); break; Index: test/Transforms/InstCombine/fcmp.ll =================================================================== --- test/Transforms/InstCombine/fcmp.ll +++ test/Transforms/InstCombine/fcmp.ll @@ -334,3 +334,20 @@ ret i1 %cmp } +define i1 @test20(double %a) nounwind { +; CHECK-LABEL: @test20( +; CHECK-NEXT: ret i1 false +; + %call = call double @llvm.fabs.f64(double %a) + %cmp = fcmp olt double %call, -1.000000e+00 + ret i1 %cmp +} + +define i1 @test21(double %a) nounwind { +; CHECK-LABEL: @test21( +; CHECK-NEXT: ret i1 true +; + %call = call double @llvm.fabs.f64(double %a) + %cmp = fcmp uge double %call, -1.000000e+00 + ret i1 %cmp +}