[PATCH] D35566: [DAG] Extend visitSCALAR_TO_VECTOR optimization to truncated vector.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 18 14:24:18 PDT 2017
efriedma added inline comments.
================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:15628
ConstantSDNode *C0 = dyn_cast<ConstantSDNode>(EltNo);
- if (C0 && VT == InVec.getValueType() &&
- VT.getScalarType() == InVal.getValueType()) {
- SmallVector<int, 8> NewMask(VT.getVectorNumElements(), -1);
+ if (C0 && VT.getScalarType() == InVal.getValueType()) {
+ SmallVector<int, 8> NewMask(InVecT.getVectorNumElements(), -1);
----------------
The only way for `VT.getScalarType() == InVal.getValueType()` to be false is if legalization promoted it to a larger integer type... and I can't why that should block the transform (the extra bits get discarded anyway).
================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:15635
NewMask);
+ if (VT.getVectorNumElements() <= InVecT.getVectorNumElements() &&
+ TLI.isShuffleMaskLegal(NewMask, VT)) {
----------------
Do you need to check that the element type matches? And in that case, isn't the "VT.getVectorNumElements() == InVecT.getVectorNumElements()" check redundant (since it implies `VT == InVecT`)?
https://reviews.llvm.org/D35566
More information about the llvm-commits
mailing list