[PATCH] D86403: [DAGCombine]: Fold X/Sqrt(X) to Sqrt(X).

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 22 13:09:45 PDT 2020


spatel added a comment.

In D86403#2232094 <https://reviews.llvm.org/D86403#2232094>, @venkataramanan.kumar.llvm wrote:

> Hi Sanjay,
>
> As discussed in  InstCombine patch <https://reviews.llvm.org/D85709>, moving the transformation to generic "DagCombine".  I have adjusted the test case for X86_64 target. I am not sure if I need to do add/change test cases for other targets.

Yes, you need to update any tests that are no longer passing with this patch. That's why the buildbot flagged this patch with failures.



================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:13357
+  // Fold X/Sqrt(X) -> Sqrt(X)
+  if ((Options.NoNaNsFPMath || Flags.hasNoNaNs()) &&
+      (Options.UnsafeFPMath || Flags.hasAllowReassociation()))
----------------
I don't think 'nnan' is required. A NAN input results in NAN output either way.
NAN/sqrt(NAN) == NAN == sqrt(NAN)

I included 'arcp' in the tests that I added just to make sure that we were bypassing the sqrt estimate creation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86403



More information about the llvm-commits mailing list