[PATCH] D44091: [DAGCombiner] New sign-of-zero compliant patterns for fabs folding

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 5 11:33:29 PST 2018


spatel added a comment.

I fixed the test file to check all output here:
https://reviews.llvm.org/rL326735
Use the script to auto-generate check lines for any tests that you are adding.

Please rebase and upload the patch with full context:
https://llvm.org/docs/Phabricator.html#phabricator-request-review-web



================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:16964
+      // for nsz before folding.
+      if (N0.getNode()->getFlags().hasNoSignedZeros()) {
+        // select (setg[te] X, +/-0.0), X, fneg(X) -> fabs
----------------
We're checking the flags on a node, but there is no regression test with 'nsz' FMF on the IR?


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:16982-16983
+          N0 == N3.getOperand(1)) {
+        if (ConstantFPSDNode *CZ =
+                dyn_cast<ConstantFPSDNode>(N3.getOperand(0))) {
+          if (CZ->isZero() && !CZ->isNegative())
----------------
Use 'auto' with 'dyn_cast':
http://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable

...although what happens with vector types? Are they handled on a different path?


Repository:
  rL LLVM

https://reviews.llvm.org/D44091





More information about the llvm-commits mailing list