[llvm-branch-commits] [llvm] aebb4a6 - [RISCV] Rewrite and simplify helper function. NFC.
Fraser Cormack via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Dec 29 03:40:44 PST 2020
Author: Fraser Cormack
Date: 2020-12-29T11:29:44Z
New Revision: aebb4a60522615ca4fd542e8ece8df1e4f42d657
URL: https://github.com/llvm/llvm-project/commit/aebb4a60522615ca4fd542e8ece8df1e4f42d657
DIFF: https://github.com/llvm/llvm-project/commit/aebb4a60522615ca4fd542e8ece8df1e4f42d657.diff
LOG: [RISCV] Rewrite and simplify helper function. NFC.
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D93851
Added:
Modified:
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 92bb316356c6..b643f76e1fb5 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -2487,19 +2487,14 @@ static bool CC_RISCV(const DataLayout &DL, RISCVABI::ABI ABI, unsigned ValNo,
}
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 @@ void RISCVTargetLowering::analyzeInputArgs(
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 @@ void RISCVTargetLowering::analyzeOutputArgs(
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 @@ bool RISCVTargetLowering::CanLowerReturn(
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;
More information about the llvm-branch-commits
mailing list