[PATCH] D40209: [DAGCombiner] eliminate shuffle of insert element
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 27 16:57:41 PST 2017
efriedma added inline comments.
================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:15737
+ for (int i = 0; i != MaskSize; ++i) {
+ if (Mask[i] >= 0 && Mask[i] < MaskSize) {
+ // We're looking for a shuffle of exactly one element from operand 0.
----------------
Do we need to handle the case where `Mask[i] < 0`?
================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:15778
+ "Shuffle mask value must be from operand 0");
+ if (Op0.getOpcode() != ISD::INSERT_VECTOR_ELT)
+ return SDValue();
----------------
I guess there's sort of a family of related transforms here... does it make sense to optimize other cases where we know the value? A SCALAR_TO_VECTOR? A constant? A BUILD_VECTOR? Another shuffle we could examine recursively? (Not that you need to implement any of that right now, but it would make sense to note the direction you expect for future generalizations.)
https://reviews.llvm.org/D40209
More information about the llvm-commits
mailing list