Skip to content

Commit

Permalink
[DebugInfo][InstrRef][MIR][GlobalIsel][MachineLICM] NFC Use std::move…
Browse files Browse the repository at this point in the history
… to avoid copying (llvm#116935)
  • Loading branch information
abhishek-kaushik22 authored Nov 21, 2024
1 parent abb9f9f commit 46f43b6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ void GISelKnownBits::computeKnownBitsImpl(Register R, KnownBits &Known,
computeKnownBitsImpl(SrcReg, SrcOpKnown, SubDemandedElts, Depth + 1);

if (SrcTy.isVector())
Known = SrcOpKnown;
Known = std::move(SrcOpKnown);
else
Known = SrcOpKnown.extractBits(BitWidth, BitWidth * DstIdx);
break;
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2927,7 +2927,7 @@ std::optional<ValueIDNum> InstrRefBasedLDV::pickOperandPHILoc(
SmallVector<LocIdx, 4> NewCandidates;
std::set_intersection(CandidateLocs.begin(), CandidateLocs.end(),
LocVec.begin(), LocVec.end(), std::inserter(NewCandidates, NewCandidates.begin()));
CandidateLocs = NewCandidates;
CandidateLocs = std::move(NewCandidates);
}
if (CandidateLocs.empty())
return std::nullopt;
Expand Down
8 changes: 4 additions & 4 deletions llvm/lib/CodeGen/MIRPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ void MIRPrinter::convert(yaml::MachineFunction &YamlMF,
if (PreferredReg)
printRegMIR(PreferredReg, VReg.PreferredRegister, TRI);
printRegFlags(Reg, VReg.RegisterFlags, MF, TRI);
YamlMF.VirtualRegisters.push_back(VReg);
YamlMF.VirtualRegisters.push_back(std::move(VReg));
}

// Print the live ins.
Expand All @@ -354,7 +354,7 @@ void MIRPrinter::convert(yaml::MachineFunction &YamlMF,
printRegMIR(LI.first, LiveIn.Register, TRI);
if (LI.second)
printRegMIR(LI.second, LiveIn.VirtualRegister, TRI);
YamlMF.LiveIns.push_back(LiveIn);
YamlMF.LiveIns.push_back(std::move(LiveIn));
}

// Prints the callee saved registers.
Expand All @@ -364,9 +364,9 @@ void MIRPrinter::convert(yaml::MachineFunction &YamlMF,
for (const MCPhysReg *I = CalleeSavedRegs; *I; ++I) {
yaml::FlowStringValue Reg;
printRegMIR(*I, Reg, TRI);
CalleeSavedRegisters.push_back(Reg);
CalleeSavedRegisters.push_back(std::move(Reg));
}
YamlMF.CalleeSavedRegisters = CalleeSavedRegisters;
YamlMF.CalleeSavedRegisters = std::move(CalleeSavedRegisters);
}
}

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/MachineLICM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ namespace {
if (Inserted) {
SmallVector<MachineBasicBlock *, 8> ExitBlocks;
CurLoop->getExitBlocks(ExitBlocks);
It->second = ExitBlocks;
It->second = std::move(ExitBlocks);
}
return is_contained(It->second, MBB);
}
Expand Down

0 comments on commit 46f43b6

Please sign in to comment.