[PATCH] D106362: [FPEnv][InstSimplify] Enable more folds for constrained fadd

Serge Pavlov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 29 03:24:38 PDT 2021


sepavloff added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:4908
+      (!RoundingModeMayBe(Rounding, RoundingMode::TowardNegative) &&
+       (ExBehavior != fp::ebStrict || FMF.noNaNs())))
+    if (match(Op1, m_NegZeroFP()))
----------------
Even if `ExBehavior != fp::ebStrict` this transformation is invalid if `X` is SNaN, the latter must be converted to QNaN.




================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:4914
+  if (isDefaultFPEnvironment(ExBehavior, Rounding) ||
+      (ExBehavior != fp::ebStrict || FMF.noNaNs()))
+    if (match(Op1, m_PosZeroFP()) &&
----------------
The same about `X==SNaN`.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:4922
 
   // With nnan: -X + X --> 0.0 (and commuted variant)
   // We don't have to explicitly exclude infinities (ninf): INF + -INF == NaN.
----------------
What about making such transformation in non-default mode?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106362/new/

https://reviews.llvm.org/D106362



More information about the llvm-commits mailing list