Skip to content

Commit 46f43b6

Browse files
[DebugInfo][InstrRef][MIR][GlobalIsel][MachineLICM] NFC Use std::move to avoid copying (#116935)
1 parent abb9f9f commit 46f43b6

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ void GISelKnownBits::computeKnownBitsImpl(Register R, KnownBits &Known,
537537
computeKnownBitsImpl(SrcReg, SrcOpKnown, SubDemandedElts, Depth + 1);
538538

539539
if (SrcTy.isVector())
540-
Known = SrcOpKnown;
540+
Known = std::move(SrcOpKnown);
541541
else
542542
Known = SrcOpKnown.extractBits(BitWidth, BitWidth * DstIdx);
543543
break;

llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2927,7 +2927,7 @@ std::optional<ValueIDNum> InstrRefBasedLDV::pickOperandPHILoc(
29272927
SmallVector<LocIdx, 4> NewCandidates;
29282928
std::set_intersection(CandidateLocs.begin(), CandidateLocs.end(),
29292929
LocVec.begin(), LocVec.end(), std::inserter(NewCandidates, NewCandidates.begin()));
2930-
CandidateLocs = NewCandidates;
2930+
CandidateLocs = std::move(NewCandidates);
29312931
}
29322932
if (CandidateLocs.empty())
29332933
return std::nullopt;

llvm/lib/CodeGen/MIRPrinter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ void MIRPrinter::convert(yaml::MachineFunction &YamlMF,
345345
if (PreferredReg)
346346
printRegMIR(PreferredReg, VReg.PreferredRegister, TRI);
347347
printRegFlags(Reg, VReg.RegisterFlags, MF, TRI);
348-
YamlMF.VirtualRegisters.push_back(VReg);
348+
YamlMF.VirtualRegisters.push_back(std::move(VReg));
349349
}
350350

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

360360
// Prints the callee saved registers.
@@ -364,9 +364,9 @@ void MIRPrinter::convert(yaml::MachineFunction &YamlMF,
364364
for (const MCPhysReg *I = CalleeSavedRegs; *I; ++I) {
365365
yaml::FlowStringValue Reg;
366366
printRegMIR(*I, Reg, TRI);
367-
CalleeSavedRegisters.push_back(Reg);
367+
CalleeSavedRegisters.push_back(std::move(Reg));
368368
}
369-
YamlMF.CalleeSavedRegisters = CalleeSavedRegisters;
369+
YamlMF.CalleeSavedRegisters = std::move(CalleeSavedRegisters);
370370
}
371371
}
372372

llvm/lib/CodeGen/MachineLICM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ namespace {
151151
if (Inserted) {
152152
SmallVector<MachineBasicBlock *, 8> ExitBlocks;
153153
CurLoop->getExitBlocks(ExitBlocks);
154-
It->second = ExitBlocks;
154+
It->second = std::move(ExitBlocks);
155155
}
156156
return is_contained(It->second, MBB);
157157
}

0 commit comments

Comments
 (0)