diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp index 0b41c90442a5d..e936b16531373 100644 --- a/llvm/lib/CodeGen/MIRPrinter.cpp +++ b/llvm/lib/CodeGen/MIRPrinter.cpp @@ -452,7 +452,7 @@ void MIRPrinter::convertStackObjects(yaml::MachineFunction &YMF, YamlObject.IsAliased = MFI.isAliasedObjectIndex(I); // Save the ID' position in FixedStackObjects storage vector. FixedStackObjectsIdx[ID] = YMF.FixedStackObjects.size(); - YMF.FixedStackObjects.push_back(YamlObject); + YMF.FixedStackObjects.push_back(std::move(YamlObject)); StackObjectOperandMapping.insert( std::make_pair(I, FrameIndexOperand::createFixed(ID))); } @@ -506,11 +506,11 @@ void MIRPrinter::convertStackObjects(yaml::MachineFunction &YMF, auto &Object = YMF.FixedStackObjects [FixedStackObjectsIdx[FrameIdx + MFI.getNumFixedObjects()]]; - Object.CalleeSavedRegister = Reg; + Object.CalleeSavedRegister = std::move(Reg); Object.CalleeSavedRestored = CSInfo.isRestored(); } else { auto &Object = YMF.StackObjects[StackObjectsIdx[FrameIdx]]; - Object.CalleeSavedRegister = Reg; + Object.CalleeSavedRegister = std::move(Reg); Object.CalleeSavedRestored = CSInfo.isRestored(); } } @@ -576,7 +576,7 @@ void MIRPrinter::convertCallSiteObjects(yaml::MachineFunction &YMF, printRegMIR(ArgReg.Reg, YmlArgReg.Reg, TRI); YmlCS.ArgForwardingRegs.emplace_back(YmlArgReg); } - YMF.CallSitesInfo.push_back(YmlCS); + YMF.CallSitesInfo.push_back(std::move(YmlCS)); } // Sort call info by position of call instructions. @@ -597,7 +597,7 @@ void MIRPrinter::convertMachineMetadataNodes(yaml::MachineFunction &YMF, std::string NS; raw_string_ostream StrOS(NS); MD.second->print(StrOS, MST, MF.getFunction().getParent()); - YMF.MachineMetadataNodes.push_back(NS); + YMF.MachineMetadataNodes.push_back(std::move(NS)); } } @@ -612,7 +612,7 @@ void MIRPrinter::convertCalledGlobals(yaml::MachineFunction &YMF, yaml::CalledGlobal YamlCG{CallSite, CG.Callee->getName().str(), CG.TargetFlags}; - YMF.CalledGlobals.push_back(YamlCG); + YMF.CalledGlobals.push_back(std::move(YamlCG)); } // Sort by position of call instructions. @@ -638,11 +638,11 @@ void MIRPrinter::convert(yaml::MachineFunction &MF, yaml::MachineConstantPoolValue YamlConstant; YamlConstant.ID = ID++; - YamlConstant.Value = Str; + YamlConstant.Value = std::move(Str); YamlConstant.Alignment = Constant.getAlign(); YamlConstant.IsTargetSpecific = Constant.isMachineConstantPoolEntry(); - MF.Constants.push_back(YamlConstant); + MF.Constants.push_back(std::move(YamlConstant)); } } @@ -661,7 +661,7 @@ void MIRPrinter::convert(ModuleSlotTracker &MST, Entry.Blocks.push_back(Str); Str.clear(); } - YamlJTI.Entries.push_back(Entry); + YamlJTI.Entries.push_back(std::move(Entry)); } } diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index 7d504ef5a0482..6e0342a763d15 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -967,13 +967,13 @@ void MachineFunction::copyAdditionalCallInfo(const MachineInstr *Old, CallSiteInfoMap::iterator CSIt = getCallSiteInfo(OldCallMI); if (CSIt != CallSitesInfo.end()) { CallSiteInfo CSInfo = CSIt->second; - CallSitesInfo[New] = CSInfo; + CallSitesInfo[New] = std::move(CSInfo); } CalledGlobalsMap::iterator CGIt = CalledGlobalsInfo.find(OldCallMI); if (CGIt != CalledGlobalsInfo.end()) { CalledGlobalInfo CGInfo = CGIt->second; - CalledGlobalsInfo[New] = CGInfo; + CalledGlobalsInfo[New] = std::move(CGInfo); } } @@ -991,14 +991,14 @@ void MachineFunction::moveAdditionalCallInfo(const MachineInstr *Old, if (CSIt != CallSitesInfo.end()) { CallSiteInfo CSInfo = std::move(CSIt->second); CallSitesInfo.erase(CSIt); - CallSitesInfo[New] = CSInfo; + CallSitesInfo[New] = std::move(CSInfo); } CalledGlobalsMap::iterator CGIt = CalledGlobalsInfo.find(OldCallMI); if (CGIt != CalledGlobalsInfo.end()) { CalledGlobalInfo CGInfo = std::move(CGIt->second); CalledGlobalsInfo.erase(CGIt); - CalledGlobalsInfo[New] = CGInfo; + CalledGlobalsInfo[New] = std::move(CGInfo); } }