-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AArch64][SVE][SelectionDAG] infinite loop caused by legalizing & combining CONCAT_VECTORS #63322
Comments
I found the error "SmallVector unable to grow" is due to an infinite loop caused by legalizing & combining CONCAT_VECTORS.
During legalizing, t4091 is converted to t4094 and t4092. During combining, t4094 and t4092 is converted to t4095. Note that t4091 and t4095 have exactly the same form. |
The legalizing happens in // Concat each pair of subvectors and pack into the lower half of the array.
SmallVector<SDValue> ConcatOps(Op->op_begin(), Op->op_end());
while (ConcatOps.size() > 1) {
for (unsigned I = 0, E = ConcatOps.size(); I != E; I += 2) {
SDValue V1 = ConcatOps[I];
SDValue V2 = ConcatOps[I + 1];
EVT SubVT = V1.getValueType();
EVT PairVT = SubVT.getDoubleNumVectorElementsVT(*DAG.getContext());
ConcatOps[I / 2] =
DAG.getNode(ISD::CONCAT_VECTORS, SDLoc(Op), PairVT, V1, V2);
}
ConcatOps.resize(ConcatOps.size() / 2);
}
return ConcatOps[0]; The combining happens in // If the input is a concat_vectors, just make a larger concat by padding
// with smaller undefs.
if (In.getOpcode() == ISD::CONCAT_VECTORS && In.hasOneUse()) {
unsigned NumOps = N->getNumOperands() * In.getNumOperands();
SmallVector<SDValue, 4> Ops(In->op_begin(), In->op_end());
Ops.resize(NumOps, DAG.getUNDEF(Ops[0].getValueType()));
return DAG.getNode(ISD::CONCAT_VECTORS, SDLoc(N), VT, Ops);
} |
This issue is related to [DAG] Fold concat_vectors(concat_vectors(x,y),concat_vectors(a,b)). |
Modifying @@ -23167,7 +23167,8 @@ SDValue DAGCombiner::visitCONCAT_VECTORS(SDNode *N) {
// If the input is a concat_vectors, just make a larger concat by padding
// with smaller undefs.
- if (In.getOpcode() == ISD::CONCAT_VECTORS && In.hasOneUse()) {
+ if (In.getOpcode() == ISD::CONCAT_VECTORS && In.hasOneUse() &&
+ (!In.getValueType().isScalableVector() || !LegalDAG)) {
unsigned NumOps = N->getNumOperands() * In.getNumOperands();
SmallVector<SDValue, 4> Ops(In->op_begin(), In->op_end());
Ops.resize(NumOps, DAG.getUNDEF(Ops[0].getValueType())); However I am not sure whether it is the right fix. |
@llvm/issue-subscribers-backend-aarch64 |
The text was updated successfully, but these errors were encountered: