diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h --- a/llvm/include/llvm/CodeGen/TargetLowering.h +++ b/llvm/include/llvm/CodeGen/TargetLowering.h @@ -177,8 +177,8 @@ class ArgListEntry { public: - Value *Val = nullptr; - SDValue Node = SDValue(); + Value *Val = nullptr; // Only used by FastISel + SDValue Node = SDValue(); // Not used by FastISel Type *Ty = nullptr; bool IsSExt : 1; bool IsZExt : 1; @@ -199,6 +199,12 @@ IsNest(false), IsByVal(false), IsInAlloca(false), IsReturned(false), IsSwiftSelf(false), IsSwiftError(false), IsCFGuardTarget(false) {} + ArgListEntry(Value *Val) + : Val(Val), Ty(Val->getType()), IsSExt(false), IsZExt(false), + IsInReg(false), IsSRet(false), IsNest(false), IsByVal(false), + IsInAlloca(false), IsReturned(false), IsSwiftSelf(false), + IsSwiftError(false), IsCFGuardTarget(false) {} + void setAttributes(const CallBase *Call, unsigned ArgIdx); void setAttributes(ImmutableCallSite *CS, unsigned ArgIdx) { diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp --- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -877,9 +877,7 @@ assert(!V->getType()->isEmptyTy() && "Empty type passed to intrinsic."); - ArgListEntry Entry; - Entry.Val = V; - Entry.Ty = V->getType(); + ArgListEntry Entry(V); Entry.setAttributes(&CS, ArgI); Args.push_back(Entry); } @@ -1119,9 +1117,7 @@ assert(!V->getType()->isEmptyTy() && "Empty type passed to intrinsic."); - ArgListEntry Entry; - Entry.Val = V; - Entry.Ty = V->getType(); + ArgListEntry Entry(V); Entry.setAttributes(&CS, ArgI); Args.push_back(Entry); } @@ -1252,7 +1248,6 @@ Type *RetTy = CS.getType(); ArgListTy Args; - ArgListEntry Entry; Args.reserve(CS.arg_size()); for (ImmutableCallSite::arg_iterator i = CS.arg_begin(), e = CS.arg_end(); @@ -1263,8 +1258,7 @@ if (V->getType()->isEmptyTy()) continue; - Entry.Val = V; - Entry.Ty = V->getType(); + ArgListEntry Entry(V); // Skip the first return-type Attribute to get to params. Entry.setAttributes(&CS, i - CS.arg_begin()); diff --git a/llvm/lib/Target/AArch64/AArch64FastISel.cpp b/llvm/lib/Target/AArch64/AArch64FastISel.cpp --- a/llvm/lib/Target/AArch64/AArch64FastISel.cpp +++ b/llvm/lib/Target/AArch64/AArch64FastISel.cpp @@ -3607,12 +3607,8 @@ Args.reserve(II->getNumArgOperands()); // Populate the argument list. - for (auto &Arg : II->arg_operands()) { - ArgListEntry Entry; - Entry.Val = Arg; - Entry.Ty = Arg->getType(); - Args.push_back(Entry); - } + for (auto &Arg : II->arg_operands()) + Args.push_back(ArgListEntry(Arg)); CallLoweringInfo CLI; MCContext &Ctx = MF->getContext(); @@ -4906,12 +4902,8 @@ Args.reserve(I->getNumOperands()); // Populate the argument list. - for (auto &Arg : I->operands()) { - ArgListEntry Entry; - Entry.Val = Arg; - Entry.Ty = Arg->getType(); - Args.push_back(Entry); - } + for (auto &Arg : I->operands()) + Args.push_back(ArgListEntry(Arg)); CallLoweringInfo CLI; MCContext &Ctx = MF->getContext();