[PATCH] D24683: [DAGCombine] Generalize build_vector -> vector_shuffle combine for more than 2 inputs

Elena Demikhovsky via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 28 02:48:46 PDT 2016


delena accepted this revision.
delena added a comment.
This revision is now accepted and ready to land.

Some minor comments inside.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:13030
@@ +13029,3 @@
+    // All inputs must have the same element type as the output.
+    if (VT.getVectorElementType() !=
+        ExtractedFromVec.getValueType().getVectorElementType())
----------------
mkuper wrote:
> delena wrote:
> > I suppose you can put "assert" here.
> I guess the comment is ambiguous - by "must" I didn't mean that we never get here if that doesn't happen, but that it's required for the combine. I'll change the comment.
You can't create BUILD_VECTOR node of v8i32 and put i8 operands for it.

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:13038
@@ +13037,3 @@
+    unsigned Idx = std::distance(
+        VecIn.begin(), std::find(VecIn.begin(), VecIn.end(), ExtractedFromVec));
+    if (Idx == VecIn.size())
----------------
line alignment

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:13045
@@ +13044,3 @@
+
+  // If we didn't find at least one input vector, bail out.
+  if (VecIn.size() < 2)
----------------
at least two?

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:13073
@@ +13072,3 @@
+    SDValue VecRight =
+        (LeftIdx + 1) < VecIn.size() ? VecIn[LeftIdx + 1] : SDValue();
+
----------------
line alignment


https://reviews.llvm.org/D24683





More information about the llvm-commits mailing list