[PATCH] D75348: [DAGCombiner] recognize shuffle (shuffle X, Mask0), Mask --> splat X
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 28 06:40:31 PST 2020
lebedev.ri added a comment.
Sounds good to me modulo legality check.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:19264
+/// Combine shuffle of shuffle of the form:
+/// shuf (shuf0 V, undef, MaskOp0), undef, Mask --> splat V
+static SDValue formSplatFromShuffles(ShuffleVectorSDNode *Shuf,
----------------
I'd suggest `OuterShuf` and `InnerShuf`
================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:19277
+ assert(NumElts == MaskOp0.size() && "Mask length mismatch");
+ SmallVector<int, 32> NewMask(NumElts, -1);
+ int SplatIndex = -1;
----------------
`CombinedMask`? Not sure.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:19282-19286
+ if (MaskElt == -1 || MaskOp0[MaskElt] == -1)
+ continue;
+
+ // Peek through the shuffle masks to get the underlying source element.
+ int MaskOp0Elt = MaskOp0[MaskElt];
----------------
Might it be more obvious to do
```
int MaskElt = Mask[i];
if (MaskElt == -1)
continue;
// Peek through the shuffle masks to get the underlying source element.
int MaskOp0Elt = MaskOp0[MaskElt];
if (MaskOp0Elt == -1)
continue;
```
?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75348/new/
https://reviews.llvm.org/D75348
More information about the llvm-commits
mailing list