Index: llvm/trunk/lib/Analysis/InstructionSimplify.cpp =================================================================== --- llvm/trunk/lib/Analysis/InstructionSimplify.cpp +++ llvm/trunk/lib/Analysis/InstructionSimplify.cpp @@ -3235,7 +3235,7 @@ // If the constant is a nan, see if we can fold the comparison based on it. if (CFP->getValueAPF().isNaN()) { if (FCmpInst::isOrdered(Pred)) // True "if ordered and foo" - return ConstantInt::getFalse(CFP->getContext()); + return ConstantInt::get(GetCompareTy(LHS), 0); assert(FCmpInst::isUnordered(Pred) && "Comparison must be either ordered or unordered!"); // True if unordered. Index: llvm/trunk/test/Transforms/InstSimplify/floating-point-compare.ll =================================================================== --- llvm/trunk/test/Transforms/InstSimplify/floating-point-compare.ll +++ llvm/trunk/test/Transforms/InstSimplify/floating-point-compare.ll @@ -123,3 +123,11 @@ %cmp = fcmp nnan ord double %in1, %in2 ret i1 %cmp } + +define <2 x i1> @orderedCompareWithNaNVector(<2 x double> %A) { +; CHECK-LABEL: @orderedCompareWithNaNVector( +; CHECK: ret <2 x i1> zeroinitializer + %cmp = fcmp olt <2 x double> %A, + ret <2 x i1> %cmp +} +