[PATCH] D107285: [FPEnv][InstSimplify] Enable more folds for constrained fsub

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 28 09:00:08 PDT 2021


spatel added a comment.

Please add the test file as a preliminary commit. Then update here to show the code diffs. Also as part of this patch, apply comments on the tests that are intentionally not changing and/or are expected to change later (TODO).



================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:4996
   // fsub X, +0 ==> X
-  if (match(Op1, m_PosZeroFP()))
-    return Op0;
+  if (ExBehavior == fp::ebIgnore || FMF.noNaNs())
+    if (match(Op1, m_PosZeroFP()))
----------------
This clause is going to be repeated in many places. Make it or its inverse a helper function and give it a name (canIgnoreSNAN or mustPreserveSNAN?).


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

https://reviews.llvm.org/D107285



More information about the llvm-commits mailing list