[PATCH] D13665: [DAG] Add common vector constant folding helper function

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 12 14:07:30 PDT 2015


qcolombet added a comment.

Hi Simon,

This mostly LGTM, just a few fixes in the comments.

Thanks,
-Quentin


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:13483
@@ -13542,1 +13482,3 @@
+          DAG.getNode(N->getOpcode(), SDLoc(N), VT, LHS.getOperand(0),
+                      RHS.getOperand(0), N->getFlags());
       AddUsersToWorklist(N);
----------------
This change is unrelated.

================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:3345
@@ +3344,3 @@
+  if (!std::all_of(Ops.begin(), Ops.end(), IsConstantBuildVectorOrUndef) ||
+      !std::all_of(Ops.begin(), Ops.end(), IsSameVectorSize))
+    return SDValue();
----------------
The IsSameVectorSize is not checking the width of the vector type, just the number of lanes.

================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:3389
@@ +3388,3 @@
+
+    // Scalar folding only succeeded if we a constant or undef result.
+    if (ScalarResult.getOpcode() != ISD::UNDEF &&
----------------
The verb is missing.


Repository:
  rL LLVM

http://reviews.llvm.org/D13665





More information about the llvm-commits mailing list