Skip to content

Commit eeaff5c

Browse files
committed
Assert number of ops is power of 2, rename recursive variables
1 parent adda09e commit eeaff5c

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15307,18 +15307,19 @@ performCONCAT_VECTORSSplitCombine(SDNode *N, SelectionDAG &DAG,
1530715307
MVT VT = N->getSimpleValueType(0);
1530815308

1530915309
MVT HalfVT = VT.getHalfNumVectorElementsVT();
15310-
size_t HalfNumOps = (N->getNumOperands() + 1) / 2;
15311-
SDValue BotSubConcat = DAG.getNode(ISD::CONCAT_VECTORS, DL, HalfVT,
15312-
N->ops().take_front(HalfNumOps));
15313-
SDValue TopSubConcat = DAG.getNode(ISD::CONCAT_VECTORS, DL, HalfVT,
15314-
N->ops().drop_front(HalfNumOps));
15310+
assert(isPowerOf2_32(N->getNumOperands()));
15311+
size_t HalfNumOps = N->getNumOperands() / 2;
15312+
SDValue Lo = DAG.getNode(ISD::CONCAT_VECTORS, DL, HalfVT,
15313+
N->ops().take_front(HalfNumOps));
15314+
SDValue Hi = DAG.getNode(ISD::CONCAT_VECTORS, DL, HalfVT,
15315+
N->ops().drop_front(HalfNumOps));
1531515316

1531615317
// Lower to an insert_subvector directly so the concat_vectors don't get
1531715318
// recombined.
15318-
SDValue Vec = DAG.getNode(ISD::INSERT_SUBVECTOR, DL, VT, DAG.getUNDEF(VT),
15319-
BotSubConcat, DAG.getVectorIdxConstant(0, DL));
15319+
SDValue Vec = DAG.getNode(ISD::INSERT_SUBVECTOR, DL, VT, DAG.getUNDEF(VT), Lo,
15320+
DAG.getVectorIdxConstant(0, DL));
1532015321
Vec = DAG.getNode(
15321-
ISD::INSERT_SUBVECTOR, DL, VT, Vec, TopSubConcat,
15322+
ISD::INSERT_SUBVECTOR, DL, VT, Vec, Hi,
1532215323
DAG.getVectorIdxConstant(HalfVT.getVectorMinNumElements(), DL));
1532315324
return Vec;
1532415325
}

0 commit comments

Comments
 (0)