Index: llvm/include/llvm/CodeGen/GlobalISel/CSEInfo.h =================================================================== --- llvm/include/llvm/CodeGen/GlobalISel/CSEInfo.h +++ llvm/include/llvm/CodeGen/GlobalISel/CSEInfo.h @@ -173,7 +173,7 @@ : ID(ID), MRI(MRI) {} // Profiling methods. const GISelInstProfileBuilder &addNodeIDOpcode(unsigned Opc) const; - const GISelInstProfileBuilder &addNodeIDRegType(const LLT &Ty) const; + const GISelInstProfileBuilder &addNodeIDRegType(const LLT Ty) const; const GISelInstProfileBuilder &addNodeIDRegType(const unsigned) const; const GISelInstProfileBuilder & Index: llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h =================================================================== --- llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h +++ llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h @@ -81,7 +81,7 @@ // Can't use MIPattern because we don't have a specific constant in mind. auto *SrcMI = MRI.getVRegDef(SrcReg); if (SrcMI->getOpcode() == TargetOpcode::G_CONSTANT) { - const LLT &DstTy = MRI.getType(DstReg); + const LLT DstTy = MRI.getType(DstReg); if (isInstLegal({TargetOpcode::G_CONSTANT, {DstTy}})) { auto &CstVal = SrcMI->getOperand(1); Builder.buildConstant( @@ -125,7 +125,7 @@ // Can't use MIPattern because we don't have a specific constant in mind. auto *SrcMI = MRI.getVRegDef(SrcReg); if (SrcMI->getOpcode() == TargetOpcode::G_CONSTANT) { - const LLT &DstTy = MRI.getType(DstReg); + const LLT DstTy = MRI.getType(DstReg); if (isInstLegal({TargetOpcode::G_CONSTANT, {DstTy}})) { auto &CstVal = SrcMI->getOperand(1); Builder.buildConstant( @@ -178,7 +178,7 @@ // Can't use MIPattern because we don't have a specific constant in mind. auto *SrcMI = MRI.getVRegDef(SrcReg); if (SrcMI->getOpcode() == TargetOpcode::G_CONSTANT) { - const LLT &DstTy = MRI.getType(DstReg); + const LLT DstTy = MRI.getType(DstReg); if (isInstLegal({TargetOpcode::G_CONSTANT, {DstTy}})) { auto &CstVal = SrcMI->getOperand(1); Builder.buildConstant( Index: llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h =================================================================== --- llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h +++ llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h @@ -153,7 +153,7 @@ LLT NewType; LegalizeActionStep(LegalizeAction Action, unsigned TypeIdx, - const LLT &NewType) + const LLT NewType) : Action(Action), TypeIdx(TypeIdx), NewType(NewType) {} bool operator==(const LegalizeActionStep &RHS) const { @@ -739,7 +739,7 @@ } /// Ensure the scalar or element is at least as wide as Ty. - LegalizeRuleSet &minScalarOrElt(unsigned TypeIdx, const LLT &Ty) { + LegalizeRuleSet &minScalarOrElt(unsigned TypeIdx, const LLT Ty) { using namespace LegalityPredicates; using namespace LegalizeMutations; return actionIf(LegalizeAction::WidenScalar, @@ -749,7 +749,7 @@ /// Ensure the scalar or element is at least as wide as Ty. LegalizeRuleSet &minScalarOrEltIf(LegalityPredicate Predicate, - unsigned TypeIdx, const LLT &Ty) { + unsigned TypeIdx, const LLT Ty) { using namespace LegalityPredicates; using namespace LegalizeMutations; return actionIf(LegalizeAction::WidenScalar, @@ -759,7 +759,7 @@ } /// Ensure the scalar is at least as wide as Ty. - LegalizeRuleSet &minScalar(unsigned TypeIdx, const LLT &Ty) { + LegalizeRuleSet &minScalar(unsigned TypeIdx, const LLT Ty) { using namespace LegalityPredicates; using namespace LegalizeMutations; return actionIf(LegalizeAction::WidenScalar, @@ -768,7 +768,7 @@ } /// Ensure the scalar is at most as wide as Ty. - LegalizeRuleSet &maxScalarOrElt(unsigned TypeIdx, const LLT &Ty) { + LegalizeRuleSet &maxScalarOrElt(unsigned TypeIdx, const LLT Ty) { using namespace LegalityPredicates; using namespace LegalizeMutations; return actionIf(LegalizeAction::NarrowScalar, @@ -777,7 +777,7 @@ } /// Ensure the scalar is at most as wide as Ty. - LegalizeRuleSet &maxScalar(unsigned TypeIdx, const LLT &Ty) { + LegalizeRuleSet &maxScalar(unsigned TypeIdx, const LLT Ty) { using namespace LegalityPredicates; using namespace LegalizeMutations; return actionIf(LegalizeAction::NarrowScalar, @@ -789,7 +789,7 @@ /// For example, when the maximum size of one type depends on the size of /// another such as extracting N bits from an M bit container. LegalizeRuleSet &maxScalarIf(LegalityPredicate Predicate, unsigned TypeIdx, - const LLT &Ty) { + const LLT Ty) { using namespace LegalityPredicates; using namespace LegalizeMutations; return actionIf( @@ -801,15 +801,15 @@ } /// Limit the range of scalar sizes to MinTy and MaxTy. - LegalizeRuleSet &clampScalar(unsigned TypeIdx, const LLT &MinTy, - const LLT &MaxTy) { + LegalizeRuleSet &clampScalar(unsigned TypeIdx, const LLT MinTy, + const LLT MaxTy) { assert(MinTy.isScalar() && MaxTy.isScalar() && "Expected scalar types"); return minScalar(TypeIdx, MinTy).maxScalar(TypeIdx, MaxTy); } /// Limit the range of scalar sizes to MinTy and MaxTy. - LegalizeRuleSet &clampScalarOrElt(unsigned TypeIdx, const LLT &MinTy, - const LLT &MaxTy) { + LegalizeRuleSet &clampScalarOrElt(unsigned TypeIdx, const LLT MinTy, + const LLT MaxTy) { return minScalarOrElt(TypeIdx, MinTy).maxScalarOrElt(TypeIdx, MaxTy); } @@ -855,7 +855,7 @@ } /// Limit the number of elements in EltTy vectors to at least MinElements. - LegalizeRuleSet &clampMinNumElements(unsigned TypeIdx, const LLT &EltTy, + LegalizeRuleSet &clampMinNumElements(unsigned TypeIdx, const LLT EltTy, unsigned MinElements) { // Mark the type index as covered: typeIdx(TypeIdx); @@ -873,7 +873,7 @@ }); } /// Limit the number of elements in EltTy vectors to at most MaxElements. - LegalizeRuleSet &clampMaxNumElements(unsigned TypeIdx, const LLT &EltTy, + LegalizeRuleSet &clampMaxNumElements(unsigned TypeIdx, const LLT EltTy, unsigned MaxElements) { // Mark the type index as covered: typeIdx(TypeIdx); @@ -896,12 +896,12 @@ /// No effect if the type is not a vector or does not have the same element /// type as the constraints. /// The element type of MinTy and MaxTy must match. - LegalizeRuleSet &clampNumElements(unsigned TypeIdx, const LLT &MinTy, - const LLT &MaxTy) { + LegalizeRuleSet &clampNumElements(unsigned TypeIdx, const LLT MinTy, + const LLT MaxTy) { assert(MinTy.getElementType() == MaxTy.getElementType() && "Expected element types to agree"); - const LLT &EltTy = MinTy.getElementType(); + const LLT EltTy = MinTy.getElementType(); return clampMinNumElements(TypeIdx, EltTy, MinTy.getNumElements()) .clampMaxNumElements(TypeIdx, EltTy, MaxTy.getNumElements()); } Index: llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h =================================================================== --- llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h +++ llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h @@ -133,7 +133,7 @@ }; template <> struct bind_helper { - static bool bind(const MachineRegisterInfo &MRI, LLT &Ty, Register Reg) { + static bool bind(const MachineRegisterInfo &MRI, LLT Ty, Register Reg) { Ty = MRI.getType(Reg); if (Ty.isValid()) return true; @@ -163,7 +163,7 @@ inline bind_ty m_Reg(Register &R) { return R; } inline bind_ty m_MInstr(MachineInstr *&MI) { return MI; } -inline bind_ty m_Type(LLT &Ty) { return Ty; } +inline bind_ty m_Type(LLT Ty) { return Ty; } inline bind_ty m_Pred(CmpInst::Predicate &P) { return P; } inline operand_type_match m_Pred() { return operand_type_match(); } @@ -365,7 +365,7 @@ // Helper for checking if a Reg is of specific type. struct CheckType { LLT Ty; - CheckType(const LLT &Ty) : Ty(Ty) {} + CheckType(const LLT Ty) : Ty(Ty) {} bool match(const MachineRegisterInfo &MRI, Register Reg) { return MRI.getType(Reg) == Ty; Index: llvm/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h =================================================================== --- llvm/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h +++ llvm/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h @@ -68,7 +68,7 @@ DstOp(unsigned R) : Reg(R), Ty(DstType::Ty_Reg) {} DstOp(Register R) : Reg(R), Ty(DstType::Ty_Reg) {} DstOp(const MachineOperand &Op) : Reg(Op.getReg()), Ty(DstType::Ty_Reg) {} - DstOp(const LLT &T) : LLTTy(T), Ty(DstType::Ty_LLT) {} + DstOp(const LLT T) : LLTTy(T), Ty(DstType::Ty_LLT) {} DstOp(const TargetRegisterClass *TRC) : RC(TRC), Ty(DstType::Ty_RC) {} void addDefToMIB(MachineRegisterInfo &MRI, MachineInstrBuilder &MIB) const { @@ -223,13 +223,13 @@ MachineIRBuilderState State; protected: - void validateTruncExt(const LLT &Dst, const LLT &Src, bool IsExtend); + void validateTruncExt(const LLT Dst, const LLT Src, bool IsExtend); - void validateBinaryOp(const LLT &Res, const LLT &Op0, const LLT &Op1); - void validateShiftOp(const LLT &Res, const LLT &Op0, const LLT &Op1); + void validateBinaryOp(const LLT Res, const LLT Op0, const LLT Op1); + void validateShiftOp(const LLT Res, const LLT Op0, const LLT Op1); - void validateSelectOp(const LLT &ResTy, const LLT &TstTy, const LLT &Op0Ty, - const LLT &Op1Ty); + void validateSelectOp(const LLT ResTy, const LLT TstTy, const LLT Op0Ty, + const LLT Op1Ty); void recordInsertion(MachineInstr *MI) const; public: @@ -436,7 +436,7 @@ /// /// \return a MachineInstrBuilder for the newly created instruction. Optional materializePtrAdd(Register &Res, Register Op0, - const LLT &ValueTy, + const LLT ValueTy, uint64_t Value); /// Build and insert \p Res = G_PTR_MASK \p Op0, \p NumBits Index: llvm/lib/CodeGen/GlobalISel/CSEInfo.cpp =================================================================== --- llvm/lib/CodeGen/GlobalISel/CSEInfo.cpp +++ llvm/lib/CodeGen/GlobalISel/CSEInfo.cpp @@ -287,7 +287,7 @@ } const GISelInstProfileBuilder & -GISelInstProfileBuilder::addNodeIDRegType(const LLT &Ty) const { +GISelInstProfileBuilder::addNodeIDRegType(const LLT Ty) const { uint64_t Val = Ty.getUniqueRAWLLTData(); ID.AddInteger(Val); return *this; Index: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp =================================================================== --- llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp +++ llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp @@ -295,7 +295,7 @@ /// Select a preference between two uses. CurrentUse is the current preference /// while *ForCandidate is attributes of the candidate under consideration. PreferredTuple ChoosePreferredUse(PreferredTuple &CurrentUse, - const LLT &TyForCandidate, + const LLT TyForCandidate, unsigned OpcodeForCandidate, MachineInstr *MIForCandidate) { if (!CurrentUse.Ty.isValid()) { @@ -499,7 +499,7 @@ UseMI->getOpcode() == TargetOpcode::G_ANYEXT) { Register UseDstReg = UseMI->getOperand(0).getReg(); MachineOperand &UseSrcMO = UseMI->getOperand(1); - const LLT &UseDstTy = MRI.getType(UseDstReg); + const LLT UseDstTy = MRI.getType(UseDstReg); if (UseDstReg != ChosenDstReg) { if (Preferred.Ty == UseDstTy) { // If the use has the same type as the preferred use, then merge @@ -1151,7 +1151,7 @@ // Construct MMOs for the accesses. auto *LoadMMO = MF.getMachineMemOperand(&SrcMMO, CurrOffset, CopyTy.getSizeInBytes()); - auto *StoreMMO = + auto *StoreMMO = MF.getMachineMemOperand(&DstMMO, CurrOffset, CopyTy.getSizeInBytes()); // Create the load. Index: llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp =================================================================== --- llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp +++ llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp @@ -604,7 +604,7 @@ Cond = MIB.buildICmp(CmpInst::ICMP_SLE, i1Ty, CmpOpReg, CondRHS).getReg(0); } else { - const LLT &CmpTy = MRI->getType(CmpOpReg); + const LLT CmpTy = MRI->getType(CmpOpReg); auto Sub = MIB.buildSub({CmpTy}, CmpOpReg, CondLHS); auto Diff = MIB.buildConstant(CmpTy, High - Low); Cond = MIB.buildICmp(CmpInst::ICMP_ULE, i1Ty, Sub, Diff).getReg(0); @@ -1956,7 +1956,7 @@ if (!Idx) Idx = getOrCreateVReg(*U.getOperand(1)); if (MRI->getType(Idx).getSizeInBits() != PreferredVecIdxWidth) { - const LLT &VecIdxTy = LLT::scalar(PreferredVecIdxWidth); + const LLT VecIdxTy = LLT::scalar(PreferredVecIdxWidth); Idx = MIRBuilder.buildSExtOrTrunc(VecIdxTy, Idx).getReg(0); } MIRBuilder.buildExtractVectorElement(Res, Val, Idx); Index: llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp =================================================================== --- llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp +++ llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp @@ -199,14 +199,14 @@ .addJumpTableIndex(JTI); } -void MachineIRBuilder::validateBinaryOp(const LLT &Res, const LLT &Op0, - const LLT &Op1) { +void MachineIRBuilder::validateBinaryOp(const LLT Res, const LLT Op0, + const LLT Op1) { assert((Res.isScalar() || Res.isVector()) && "invalid operand type"); assert((Res == Op0 && Res == Op1) && "type mismatch"); } -void MachineIRBuilder::validateShiftOp(const LLT &Res, const LLT &Op0, - const LLT &Op1) { +void MachineIRBuilder::validateShiftOp(const LLT Res, const LLT Op0, + const LLT Op1) { assert((Res.isScalar() || Res.isVector()) && "invalid operand type"); assert((Res == Op0) && "type mismatch"); } @@ -223,7 +223,7 @@ Optional MachineIRBuilder::materializePtrAdd(Register &Res, Register Op0, - const LLT &ValueTy, uint64_t Value) { + const LLT ValueTy, uint64_t Value) { assert(Res == 0 && "Res is a result argument"); assert(ValueTy.isScalar() && "invalid offset type"); @@ -912,7 +912,7 @@ return buildInstr(TargetOpcode::G_BLOCK_ADDR).addDef(Res).addBlockAddress(BA); } -void MachineIRBuilder::validateTruncExt(const LLT &DstTy, const LLT &SrcTy, +void MachineIRBuilder::validateTruncExt(const LLT DstTy, const LLT SrcTy, bool IsExtend) { #ifndef NDEBUG if (DstTy.isVector()) { @@ -931,8 +931,8 @@ #endif } -void MachineIRBuilder::validateSelectOp(const LLT &ResTy, const LLT &TstTy, - const LLT &Op0Ty, const LLT &Op1Ty) { +void MachineIRBuilder::validateSelectOp(const LLT ResTy, const LLT TstTy, + const LLT Op0Ty, const LLT Op1Ty) { #ifndef NDEBUG assert((ResTy.isScalar() || ResTy.isVector() || ResTy.isPointer()) && "invalid operand type");