[llvm] d8a7888 - [CodeGen] Fix warning in visitShuffleVector
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Fri May 29 09:19:14 PDT 2020
Author: David Sherwood
Date: 2020-05-29T17:09:59+01:00
New Revision: d8a78889f633c5a60f0a1c7cb60bf9b18817d9d7
URL: https://github.com/llvm/llvm-project/commit/d8a78889f633c5a60f0a1c7cb60bf9b18817d9d7
DIFF: https://github.com/llvm/llvm-project/commit/d8a78889f633c5a60f0a1c7cb60bf9b18817d9d7.diff
LOG: [CodeGen] Fix warning in visitShuffleVector
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
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index d40f7f92c4cb..1dd5cfe1b49f 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -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()) {
@@ -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) {
More information about the llvm-commits
mailing list