@@ -18032,7 +18032,7 @@ bool RISCV::CC_RISCV(const DataLayout &DL, RISCVABI::ABI ABI, unsigned ValNo,
1803218032 }
1803318033
1803418034 // Allocate to a register if possible, or else a stack slot.
18035- Register Reg = MCRegister() ;
18035+ Register Reg;
1803618036 unsigned StoreSizeBytes = XLen / 8;
1803718037 Align StackAlign = Align(XLen / 8);
1803818038
@@ -18129,7 +18129,7 @@ void RISCVTargetLowering::analyzeInputArgs(
1812918129 unsigned NumArgs = Ins.size();
1813018130 FunctionType *FType = MF.getFunction().getFunctionType();
1813118131
18132- std::vector <Type *> TypeList;
18132+ SmallVector <Type *, 4 > TypeList;
1813318133 if (IsRet)
1813418134 TypeList.push_back(MF.getFunction().getReturnType());
1813518135 else
@@ -18164,7 +18164,7 @@ void RISCVTargetLowering::analyzeOutputArgs(
1816418164 CallLoweringInfo *CLI, RISCVCCAssignFn Fn) const {
1816518165 unsigned NumArgs = Outs.size();
1816618166
18167- std::vector <Type *> TypeList;
18167+ SmallVector <Type *, 4 > TypeList;
1816818168 if (IsRet)
1816918169 TypeList.push_back(MF.getFunction().getReturnType());
1817018170 else if (CLI)
@@ -19073,8 +19073,7 @@ bool RISCVTargetLowering::CanLowerReturn(
1907319073 SmallVector<CCValAssign, 16> RVLocs;
1907419074 CCState CCInfo(CallConv, IsVarArg, MF, RVLocs, Context);
1907519075
19076- std::vector<Type *> TypeList = {MF.getFunction().getReturnType()};
19077- RVVArgDispatcher Dispatcher{&MF, this, TypeList};
19076+ RVVArgDispatcher Dispatcher{&MF, this, MF.getFunction().getReturnType()};
1907819077
1907919078 for (unsigned i = 0, e = Outs.size(); i != e; ++i) {
1908019079 MVT VT = Outs[i].VT;
@@ -20877,7 +20876,7 @@ unsigned RISCVTargetLowering::getMinimumJumpTableEntries() const {
2087720876 return Subtarget.getMinimumJumpTableEntries();
2087820877}
2087920878
20880- void RVVArgDispatcher::constructArgInfos(Type *Ty) {
20879+ void RVVArgDispatcher::constructArgInfos(Type *Ty, bool &FirstMaskAssigned ) {
2088120880 const DataLayout &DL = MF->getDataLayout();
2088220881 const Function &F = MF->getFunction();
2088320882 LLVMContext &Context = F.getContext();
@@ -20909,21 +20908,23 @@ void RVVArgDispatcher::constructArgInfos(Type *Ty) {
2090920908 if (RegisterVT.isFixedLengthVector())
2091020909 RegisterVT = TLI->getContainerForFixedLengthVector(RegisterVT);
2091120910
20912- RVVArgInfo Info{1, RegisterVT, false};
20913- RVVArgInfos.insert(RVVArgInfos.end(), NumRegs, Info);
20911+ if (!FirstMaskAssigned && RegisterVT.getVectorElementType() == MVT::i1) {
20912+ RVVArgInfos.push_back({1, RegisterVT, true});
20913+ FirstMaskAssigned = true;
20914+ } else {
20915+ RVVArgInfos.push_back({1, RegisterVT, false});
20916+ }
20917+
20918+ RVVArgInfos.insert(RVVArgInfos.end(), --NumRegs, {1, RegisterVT, false});
2091420919 }
2091520920 }
2091620921}
2091720922
20918- void RVVArgDispatcher::construct(const std::vector<Type *> &TypeList) {
20923+ void RVVArgDispatcher::constructArgInfos(
20924+ const SmallVectorImpl<Type *> &TypeList) {
20925+ bool FirstVMaskAssigned = false;
2091920926 for (Type *Ty : TypeList)
20920- constructArgInfos(Ty);
20921-
20922- for (auto &Info : RVVArgInfos)
20923- if (Info.NF == 1 && Info.VT.getVectorElementType() == MVT::i1) {
20924- Info.FirstVMask = true;
20925- break;
20926- }
20927+ constructArgInfos(Ty, FirstVMaskAssigned);
2092720928}
2092820929
2092920930void RVVArgDispatcher::allocatePhysReg(unsigned NF, unsigned LMul,
0 commit comments