Skip to content

Commit

Permalink
[CodeGen] Fix warning in visitShuffleVector
Browse files Browse the repository at this point in the history
Make sure we only ask for the number of elements after we've
bailed out for scalable vectors.

Differential revision: https://reviews.llvm.org/D80632
  • Loading branch information
david-arm committed May 29, 2020
1 parent 634258b commit d8a7888
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Expand Up @@ -3458,7 +3458,6 @@ void SelectionDAGBuilder::visitShuffleVector(const User &I) {
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
EVT VT = TLI.getValueType(DAG.getDataLayout(), I.getType());
EVT SrcVT = Src1.getValueType();
unsigned SrcNumElts = SrcVT.getVectorNumElements();

if (all_of(Mask, [](int Elem) { return Elem == 0; }) &&
VT.isScalableVector()) {
Expand All @@ -3475,6 +3474,7 @@ void SelectionDAGBuilder::visitShuffleVector(const User &I) {
// for targets that support a SPLAT_VECTOR for non-scalable vector types.
assert(!VT.isScalableVector() && "Unsupported scalable vector shuffle");

unsigned SrcNumElts = SrcVT.getVectorNumElements();
unsigned MaskNumElts = Mask.size();

if (SrcNumElts == MaskNumElts) {
Expand Down

0 comments on commit d8a7888

Please sign in to comment.