diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index b72c5eff22f18..eb49fc90a4573 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -2199,14 +2199,9 @@ void SelectionDAGBuilder::visitRet(const ReturnInst &I) { // Emit a store of the return value through the virtual register. // Leave Outs empty so that LowerReturn won't try to load return // registers the usual way. - SmallVector PtrValueVTs; - ComputeValueVTs(TLI, DL, - PointerType::get(F->getContext(), - DAG.getDataLayout().getAllocaAddrSpace()), - PtrValueVTs); - + MVT PtrValueVT = TLI.getPointerTy(DL, DL.getAllocaAddrSpace()); SDValue RetPtr = - DAG.getCopyFromReg(Chain, getCurSDLoc(), DemoteReg, PtrValueVTs[0]); + DAG.getCopyFromReg(Chain, getCurSDLoc(), DemoteReg, PtrValueVT); SDValue RetOp = getValue(I.getOperand(0)); SmallVector ValueVTs, MemVTs; @@ -11309,13 +11304,7 @@ TargetLowering::LowerCallTo(TargetLowering::CallLoweringInfo &CLI) const { if (!CanLowerReturn) { // The instruction result is the result of loading from the // hidden sret parameter. - SmallVector PVTs; - Type *PtrRetTy = - PointerType::get(OrigRetTy->getContext(), DL.getAllocaAddrSpace()); - - ComputeValueVTs(*this, DL, PtrRetTy, PVTs); - assert(PVTs.size() == 1 && "Pointers should fit in one register"); - EVT PtrVT = PVTs[0]; + MVT PtrVT = getPointerTy(DL, DL.getAllocaAddrSpace()); unsigned NumValues = RetTys.size(); ReturnValues.resize(NumValues); @@ -11635,18 +11624,12 @@ void SelectionDAGISel::LowerArguments(const Function &F) { if (!FuncInfo->CanLowerReturn) { // Put in an sret pointer parameter before all the other parameters. - SmallVector ValueVTs; - ComputeValueVTs(*TLI, DAG.getDataLayout(), - PointerType::get(F.getContext(), - DAG.getDataLayout().getAllocaAddrSpace()), - ValueVTs); - - // NOTE: Assuming that a pointer will never break down to more than one VT - // or one register. + MVT ValueVT = TLI->getPointerTy(DL, DL.getAllocaAddrSpace()); + ISD::ArgFlagsTy Flags; Flags.setSRet(); - MVT RegisterVT = TLI->getRegisterType(*DAG.getContext(), ValueVTs[0]); - ISD::InputArg RetArg(Flags, RegisterVT, ValueVTs[0], true, + MVT RegisterVT = TLI->getRegisterType(*DAG.getContext(), ValueVT); + ISD::InputArg RetArg(Flags, RegisterVT, ValueVT, true, ISD::InputArg::NoArgIndex, 0); Ins.push_back(RetArg); } @@ -11829,12 +11812,7 @@ void SelectionDAGISel::LowerArguments(const Function &F) { if (!FuncInfo->CanLowerReturn) { // Create a virtual register for the sret pointer, and put in a copy // from the sret argument into it. - SmallVector ValueVTs; - ComputeValueVTs(*TLI, DAG.getDataLayout(), - PointerType::get(F.getContext(), - DAG.getDataLayout().getAllocaAddrSpace()), - ValueVTs); - MVT VT = ValueVTs[0].getSimpleVT(); + MVT VT = TLI->getPointerTy(DL, DL.getAllocaAddrSpace()); MVT RegVT = TLI->getRegisterType(*CurDAG->getContext(), VT); std::optional AssertOp; SDValue ArgValue =