[llvm] fab9256 - [LLVM][AArch64] Fix invalid use of AArch64ISD::UZP2 in performConcatVectorsCombine. (#104774)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 30 03:37:31 PDT 2024
Author: Paul Walker
Date: 2024-08-30T11:37:25+01:00
New Revision: fab925651685505906416dca48469fd9f69ba39a
URL: https://github.com/llvm/llvm-project/commit/fab925651685505906416dca48469fd9f69ba39a
DIFF: https://github.com/llvm/llvm-project/commit/fab925651685505906416dca48469fd9f69ba39a.diff
LOG: [LLVM][AArch64] Fix invalid use of AArch64ISD::UZP2 in performConcatVectorsCombine. (#104774)
UZP2 requires both operands to match the result type but the combine tries to replace a truncate by passing the pre-truncated operands directly to an UZP2 with the truncated result type. This patch nop-casts the operands to keep the DAG consistent. There should be no changes to the generated code, which is fine as it.
This patch also enables more target specific getNode() validation for fixed length vector types.
Added:
Modified:
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index 3296f63a9b8876..28ad0abf25703b 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -19852,7 +19852,6 @@ static SDValue performConcatVectorsCombine(SDNode *N,
// This optimization reduces instruction count.
if (N00Opc == AArch64ISD::VLSHR && N10Opc == AArch64ISD::VLSHR &&
N00->getOperand(1) == N10->getOperand(1)) {
-
SDValue N000 = N00->getOperand(0);
SDValue N100 = N10->getOperand(0);
uint64_t N001ConstVal = N00->getConstantOperandVal(1),
@@ -19860,7 +19859,8 @@ static SDValue performConcatVectorsCombine(SDNode *N,
NScalarSize = N->getValueType(0).getScalarSizeInBits();
if (N001ConstVal == N101ConstVal && N001ConstVal > NScalarSize) {
-
+ N000 = DAG.getNode(AArch64ISD::NVCAST, dl, VT, N000);
+ N100 = DAG.getNode(AArch64ISD::NVCAST, dl, VT, N100);
SDValue Uzp = DAG.getNode(AArch64ISD::UZP2, dl, VT, N000, N100);
SDValue NewShiftConstant =
DAG.getConstant(N001ConstVal - NScalarSize, dl, MVT::i32);
@@ -29344,8 +29344,10 @@ void AArch64TargetLowering::verifyTargetSDNode(const SDNode *N) const {
assert(OpVT.getSizeInBits() == VT.getSizeInBits() &&
"Expected vectors of equal size!");
// TODO: Enable assert once bogus creations have been fixed.
- // assert(OpVT.getVectorElementCount() == VT.getVectorElementCount()*2 &&
- // "Expected result vector with half the lanes of its input!");
+ if (VT.isScalableVector())
+ break;
+ assert(OpVT.getVectorElementCount() == VT.getVectorElementCount() * 2 &&
+ "Expected result vector with half the lanes of its input!");
break;
}
case AArch64ISD::TRN1:
@@ -29362,7 +29364,9 @@ void AArch64TargetLowering::verifyTargetSDNode(const SDNode *N) const {
assert(VT.isVector() && Op0VT.isVector() && Op1VT.isVector() &&
"Expected vectors!");
// TODO: Enable assert once bogus creations have been fixed.
- // assert(VT == Op0VT && VT == Op1VT && "Expected matching vectors!");
+ if (VT.isScalableVector())
+ break;
+ assert(VT == Op0VT && VT == Op1VT && "Expected matching vectors!");
break;
}
}
More information about the llvm-commits
mailing list