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

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 23 06:10:45 PDT 2020


spatel added reviewers: lebedev.ri, cameron.mcinally.
spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.

See inline for a couple of minor points, otherwise LGTM.
Adding potential reviewers from the earlier patch review to see if anyone else has comments.



================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:13359-13361
+    if (N1.getOpcode() == ISD::FSQRT && N0 == N1.getOperand(0)) {
+      return N1;
+    }
----------------
Formatting nit: the LLVM coding standards are flexible about when to use braces, but the choice here seems to not have any advantages. It would be better to either (1) omit braces entirely or (2) use braces on the first 'if' only.


================
Comment at: llvm/test/CodeGen/AArch64/sqrt-fastmath.ll:494
   %sqrt = call <2 x double> @llvm.sqrt.v2f64(<2 x double> %x)
-  %r = fdiv arcp reassoc <2 x double> %x, %sqrt
+  %r = fdiv arcp nsz reassoc <2 x double> %x, %sqrt
   ret <2 x double> %r
----------------
In general, I prefer to make test changes in a preliminary commit, so there's no question about the functional difference created by the change in the compiler code. I can do that on your behalf if you do not have commit privileges.


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

https://reviews.llvm.org/D86403



More information about the llvm-commits mailing list