Index: lib/IR/Core.cpp =================================================================== --- lib/IR/Core.cpp +++ lib/IR/Core.cpp @@ -592,6 +592,19 @@ } void LLVMSetFastMathFlags(LLVMValueRef Inst, int Flags){ + if (0 == Flags){ + FastMathFlags fmf = + (unwrap(Inst)->getFastMathFlags()); + fmf.clear(); + unwrap(Inst)->setFastMathFlags(fmf); + unwrap(Inst)->setHasUnsafeAlgebra(false); + unwrap(Inst)->setHasNoNaNs(false); + unwrap(Inst)->setHasNoInfs(false); + unwrap(Inst)->setHasNoSignedZeros(false); + unwrap(Inst)->setHasAllowReciprocal(false); + return; + } + if (Flags & FastMathFlags::UnsafeAlgebra) unwrap(Inst)->setHasUnsafeAlgebra(true); if (Flags & FastMathFlags::NoNaNs) @@ -602,12 +615,6 @@ unwrap(Inst)->setHasNoSignedZeros(true); if (Flags & FastMathFlags::AllowReciprocal) unwrap(Inst)->setHasAllowReciprocal(true); - if (0 == Flags){ - FastMathFlags fmf = - (unwrap(Inst)->getFastMathFlags()); - fmf.clear(); - unwrap(Inst)->setFastMathFlags(fmf); - } } int LLVMCountFastMathFlags(LLVMValueRef Inst){