[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 01:11:53 PDT 2016
delena added inline comments.
================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:12883
@@ -12879,14 +12882,3 @@
-// If Vec holds a reference to a non-null node, return Vec.
-// Otherwise, return either a zero or an undef node of the appropriate type.
-static SDValue getRightHandValue(SelectionDAG &DAG, SDLoc DL, SDValue Vec,
- EVT VT, bool Zero) {
- if (Vec.getNode())
- return Vec;
-
- if (Zero)
- return VT.isInteger() ? DAG.getConstant(0, DL, VT)
- : DAG.getConstantFP(0.0, DL, VT);
-
- return DAG.getUNDEF(VT);
-}
+SDValue DAGCombiner::createBuildVecShuffle(
+ SDLoc DL, SDNode *N, const SmallVectorImpl<int> &VectorMask, SDValue VecIn1,
----------------
Please add a comment here.
================
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())
----------------
I suppose you can put "assert" here.
================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:13079
@@ +13078,3 @@
+ else
+ return SDValue();
+ }
----------------
In what case it fails to create a shuffle?
================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:13084
@@ +13083,3 @@
+ // to the list of shuffles.
+ if (UsesZeroVector)
+ Shuffles.push_back(VT.isInteger() ? DAG.getConstant(0, dl, VT)
----------------
If you fail in shuffle creation, to you want to try zero-vector?
https://reviews.llvm.org/D24683
More information about the llvm-commits
mailing list