[PATCH] D93851: [RISCV] Rewrite and simplify helper function. NFC.
Fraser Cormack via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 27 23:58:33 PST 2020
frasercrmck created this revision.
frasercrmck added reviewers: craig.topper, evandro, rogfer01, HsiangKai.
Herald added subscribers: NickHung, luismarques, apazos, sameer.abuasal, pzheng, s.egerton, lenary, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya.
frasercrmck requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D93851
Files:
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
Index: llvm/lib/Target/RISCV/RISCVISelLowering.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -2487,19 +2487,14 @@
}
template <typename ArgTy>
-static void preAssignMask(const ArgTy &Args,
- Optional<unsigned> &FirstMaskArgument,
- CCState &CCInfo) {
- unsigned NumArgs = Args.size();
- for (unsigned I = 0; I != NumArgs; ++I) {
- MVT ArgVT = Args[I].VT;
- if (!ArgVT.isScalableVector() ||
- ArgVT.getVectorElementType().SimpleTy != MVT::i1)
- continue;
-
- FirstMaskArgument = I;
- break;
+static Optional<unsigned> preAssignMask(const ArgTy &Args) {
+ for (const auto &ArgIdx : enumerate(Args)) {
+ MVT ArgVT = ArgIdx.value().VT;
+ if (ArgVT.isScalableVector() &&
+ ArgVT.getVectorElementType().SimpleTy == MVT::i1)
+ return ArgIdx.index();
}
+ return None;
}
void RISCVTargetLowering::analyzeInputArgs(
@@ -2510,7 +2505,7 @@
Optional<unsigned> FirstMaskArgument;
if (Subtarget.hasStdExtV())
- preAssignMask(Ins, FirstMaskArgument, CCInfo);
+ FirstMaskArgument = preAssignMask(Ins);
for (unsigned i = 0; i != NumArgs; ++i) {
MVT ArgVT = Ins[i].VT;
@@ -2541,7 +2536,7 @@
Optional<unsigned> FirstMaskArgument;
if (Subtarget.hasStdExtV())
- preAssignMask(Outs, FirstMaskArgument, CCInfo);
+ FirstMaskArgument = preAssignMask(Outs);
for (unsigned i = 0; i != NumArgs; i++) {
MVT ArgVT = Outs[i].VT;
@@ -3312,7 +3307,7 @@
Optional<unsigned> FirstMaskArgument;
if (Subtarget.hasStdExtV())
- preAssignMask(Outs, FirstMaskArgument, CCInfo);
+ FirstMaskArgument = preAssignMask(Outs);
for (unsigned i = 0, e = Outs.size(); i != e; ++i) {
MVT VT = Outs[i].VT;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93851.313829.patch
Type: text/x-patch
Size: 1855 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201228/cd75b2a0/attachment.bin>
More information about the llvm-commits
mailing list