forked from OSchip/llvm-project
[CodeGen] Fix warnings in foldCONCAT_VECTORS
Instead of asserting the number of elements is the same, we should be comparing the element counts instead. In addition, when looking at concats of extract_subvectors it's fine to use getVectorMinNumElements() for scalable vectors. I discovered these warnings when compiling the structured loads tests in this file: test/CodeGen/AArch64/sve-intrinsics-loads.ll Differential Revision: https://reviews.llvm.org/D81936
This commit is contained in:
parent
f9c7e3136e
commit
65912a9768
|
@ -4315,8 +4315,8 @@ static SDValue foldCONCAT_VECTORS(const SDLoc &DL, EVT VT,
|
|||
return Ops[0].getValueType() == Op.getValueType();
|
||||
}) &&
|
||||
"Concatenation of vectors with inconsistent value types!");
|
||||
assert((Ops.size() * Ops[0].getValueType().getVectorNumElements()) ==
|
||||
VT.getVectorNumElements() &&
|
||||
assert((Ops[0].getValueType().getVectorElementCount() * Ops.size()) ==
|
||||
VT.getVectorElementCount() &&
|
||||
"Incorrect element count in vector concatenation!");
|
||||
|
||||
if (Ops.size() == 1)
|
||||
|
@ -4333,7 +4333,7 @@ static SDValue foldCONCAT_VECTORS(const SDLoc &DL, EVT VT,
|
|||
bool IsIdentity = true;
|
||||
for (unsigned i = 0, e = Ops.size(); i != e; ++i) {
|
||||
SDValue Op = Ops[i];
|
||||
unsigned IdentityIndex = i * Op.getValueType().getVectorNumElements();
|
||||
unsigned IdentityIndex = i * Op.getValueType().getVectorMinNumElements();
|
||||
if (Op.getOpcode() != ISD::EXTRACT_SUBVECTOR ||
|
||||
Op.getOperand(0).getValueType() != VT ||
|
||||
(IdentitySrc && Op.getOperand(0) != IdentitySrc) ||
|
||||
|
@ -4350,6 +4350,11 @@ static SDValue foldCONCAT_VECTORS(const SDLoc &DL, EVT VT,
|
|||
return IdentitySrc;
|
||||
}
|
||||
|
||||
// The code below this point is only designed to work for fixed width
|
||||
// vectors, so we bail out for now.
|
||||
if (VT.isScalableVector())
|
||||
return SDValue();
|
||||
|
||||
// A CONCAT_VECTOR with all UNDEF/BUILD_VECTOR operands can be
|
||||
// simplified to one big BUILD_VECTOR.
|
||||
// FIXME: Add support for SCALAR_TO_VECTOR as well.
|
||||
|
|
Loading…
Reference in New Issue