[libc] [lldb] [clang] [llvm] [libunwind] [flang] [lld] [libcxxabi] [clang-tools-extra] [libcxx] [compiler-rt] Fix a bug in Smith's algorithm used in complex div/mul. (PR #78330)

John McCall via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 17 10:44:56 PST 2024


================
@@ -978,7 +978,11 @@ ComplexPairTy ComplexExprEmitter::EmitBinDiv(const BinOpInfo &Op) {
       return EmitRangeReductionDiv(LHSr, LHSi, RHSr, RHSi);
     else if (Op.FPFeatures.getComplexRange() == LangOptions::CX_Limited)
       return EmitAlgebraicDiv(LHSr, LHSi, RHSr, RHSi);
-    else if (!CGF.getLangOpts().FastMath) {
+    else if (!CGF.getLangOpts().FastMath ||
+             // '-ffast-math' is used in the command line but followed by an
+             // '-fno-cx-limited-range'.
+             (CGF.getLangOpts().FastMath &&
+              Op.FPFeatures.getComplexRange() == LangOptions::CX_Full)) {
----------------
rjmccall wrote:

`FastMath` is tautologically true here.

https://github.com/llvm/llvm-project/pull/78330


More information about the cfe-commits mailing list