Skip to content

Commit 8404406

Browse files
committed
[RISCV] Make getDefaultVLOps call getDefaultScalableVLOps instead of the other way around. NFC
Previously getDefaultScalableVLOps called getDefaultVLOps. getDefaultVLOps also handles fixed vectors so had to then check if it was fixed or scalable. Since getDefaultScalableVLOps know the type is scalable, it makes sense for it to contain the scalable case directly and have getDefaultVLOps call it for the scalable case.
1 parent c79ffb0 commit 8404406

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2584,6 +2584,15 @@ static SDValue getVLOp(uint64_t NumElts, const SDLoc &DL, SelectionDAG &DAG,
25842584
return DAG.getConstant(NumElts, DL, Subtarget.getXLenVT());
25852585
}
25862586

2587+
static std::pair<SDValue, SDValue>
2588+
getDefaultScalableVLOps(MVT VecVT, const SDLoc &DL, SelectionDAG &DAG,
2589+
const RISCVSubtarget &Subtarget) {
2590+
assert(VecVT.isScalableVector() && "Expecting a scalable vector");
2591+
SDValue VL = DAG.getRegister(RISCV::X0, Subtarget.getXLenVT());
2592+
SDValue Mask = getAllOnesMask(VecVT, VL, DL, DAG);
2593+
return {Mask, VL};
2594+
}
2595+
25872596
static std::pair<SDValue, SDValue>
25882597
getDefaultVLOps(uint64_t NumElts, MVT ContainerVT, const SDLoc &DL,
25892598
SelectionDAG &DAG, const RISCVSubtarget &Subtarget) {
@@ -2604,18 +2613,7 @@ getDefaultVLOps(MVT VecVT, MVT ContainerVT, const SDLoc &DL, SelectionDAG &DAG,
26042613
return getDefaultVLOps(VecVT.getVectorNumElements(), ContainerVT, DL, DAG,
26052614
Subtarget);
26062615
assert(ContainerVT.isScalableVector() && "Expecting scalable container type");
2607-
MVT XLenVT = Subtarget.getXLenVT();
2608-
SDValue VL = DAG.getRegister(RISCV::X0, XLenVT);
2609-
SDValue Mask = getAllOnesMask(ContainerVT, VL, DL, DAG);
2610-
return {Mask, VL};
2611-
}
2612-
2613-
// As above but assuming the given type is a scalable vector type.
2614-
static std::pair<SDValue, SDValue>
2615-
getDefaultScalableVLOps(MVT VecVT, const SDLoc &DL, SelectionDAG &DAG,
2616-
const RISCVSubtarget &Subtarget) {
2617-
assert(VecVT.isScalableVector() && "Expecting a scalable vector");
2618-
return getDefaultVLOps(VecVT, VecVT, DL, DAG, Subtarget);
2616+
return getDefaultScalableVLOps(ContainerVT, DL, DAG, Subtarget);
26192617
}
26202618

26212619
SDValue RISCVTargetLowering::computeVLMax(MVT VecVT, const SDLoc &DL,

0 commit comments

Comments
 (0)