Index: include/llvm/CodeGen/SelectionDAGNodes.h =================================================================== --- include/llvm/CodeGen/SelectionDAGNodes.h +++ include/llvm/CodeGen/SelectionDAGNodes.h @@ -380,13 +380,21 @@ /// Propagate the fast-math-flags from an IR FPMathOperator. void copyFMF(const FPMathOperator &FPMO) { - setNoNaNs(FPMO.hasNoNaNs()); - setNoInfs(FPMO.hasNoInfs()); - setNoSignedZeros(FPMO.hasNoSignedZeros()); - setAllowReciprocal(FPMO.hasAllowReciprocal()); - setAllowContract(FPMO.hasAllowContract()); - setApproximateFuncs(FPMO.hasApproxFunc()); - setAllowReassociation(FPMO.hasAllowReassoc()); + // Allow for AnyDefined to be false if no flags are set + if (FPMO.hasNoNaNs()) + setNoNaNs(true); + if (FPMO.hasNoInfs()) + setNoInfs(true); + if (FPMO.hasNoSignedZeros()) + setNoSignedZeros(true); + if (FPMO.hasAllowReciprocal()) + setAllowReciprocal(true); + if (FPMO.hasAllowContract()) + setAllowContract(true); + if (FPMO.hasApproxFunc()) + setApproximateFuncs(true); + if (FPMO.hasAllowReassoc()) + setAllowReassociation(true); } /// Sets the state of the flags to the defined state. Index: test/CodeGen/X86/intersect-fma-fmf.ll =================================================================== --- test/CodeGen/X86/intersect-fma-fmf.ll +++ test/CodeGen/X86/intersect-fma-fmf.ll @@ -3,8 +3,7 @@ define float @test_x86_fma_intersection_fmf(float %a, float %b) { ; CHECK-LABEL: test_x86_fma_intersection_fmf: ; CHECK: # %bb.0: -; CHECK: vmulss {{[0-9]+}}(%esp), %xmm0, %xmm1 -; CHECK-NEXT: vaddss %xmm0, %xmm1, %xmm0 +; CHECK: vfmadd132ss {{[0-9]+}}(%esp), %xmm0, %xmm0 ; CHECK: retl %tmp8 = fmul fast float %a, %b %tmp9 = fadd fast float %tmp8, %b