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

Kevin P. Neal via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 2 09:22:11 PDT 2021


kpn 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()))
----------------
sepavloff wrote:
> Even if `ExBehavior != fp::ebStrict` this transformation is invalid if `X` is SNaN, the latter must be converted to QNaN.
> 
> 
Can I put this in a different patch? We have the same issue for constrained and non-constrained cases, and we don't have a good way to distinguish them -- nor should we.

Most of the required code is present in APFloat, but not all. Would it be OK for me to add the needed bits to APFloat and use them from InstSimplify in a different ticket?


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

https://reviews.llvm.org/D106362



More information about the llvm-commits mailing list