[llvm] d20731c - [CGData][GlobalIsel][Legalizer][DAG][MC][AsmParser][X86][AMX] Use `std::move` to avoid copy (#118068)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 5 17:46:19 PST 2024
Author: abhishek-kaushik22
Date: 2024-12-06T09:46:15+08:00
New Revision: d20731ce6bc97e2cc0d6be502ca174c14d563de2
URL: https://github.com/llvm/llvm-project/commit/d20731ce6bc97e2cc0d6be502ca174c14d563de2
DIFF: https://github.com/llvm/llvm-project/commit/d20731ce6bc97e2cc0d6be502ca174c14d563de2.diff
LOG: [CGData][GlobalIsel][Legalizer][DAG][MC][AsmParser][X86][AMX] Use `std::move` to avoid copy (#118068)
Added:
Modified:
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/lib/MC/MCParser/AsmParser.cpp
llvm/lib/MC/MCStreamer.cpp
llvm/lib/Target/X86/X86TileConfig.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
index d95fc8cfbcf558..a2737995446526 100644
--- a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
@@ -7717,9 +7717,9 @@ bool CombinerHelper::matchShuffleUndefRHS(MachineInstr &MI,
if (!Changed)
return false;
- MatchInfo = [&, NewMask](MachineIRBuilder &B) {
+ MatchInfo = [&, NewMask = std::move(NewMask)](MachineIRBuilder &B) {
B.buildShuffleVector(MI.getOperand(0), MI.getOperand(1), MI.getOperand(2),
- NewMask);
+ std::move(NewMask));
};
return true;
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 1b39b75d2687f5..34214550f3a12b 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -6823,7 +6823,7 @@ SDValue SelectionDAG::FoldConstantArithmetic(unsigned Opcode, const SDLoc &DL,
ScalarOps.push_back(getUNDEF(OpVT));
continue;
}
- APInt Val = cast<ConstantSDNode>(Op)->getAPIntValue();
+ const APInt &Val = cast<ConstantSDNode>(Op)->getAPIntValue();
ScalarOps.push_back(SignExtendInReg(Val, OpVT));
}
return getBuildVector(VT, DL, ScalarOps);
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index 3ce45f7d5d67e1..d15a9a8a36c5a3 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -6287,7 +6287,7 @@ bool AsmParser::parseMSInlineAsm(
if (AsmStart != AsmEnd)
OS << StringRef(AsmStart, AsmEnd - AsmStart);
- AsmString = AsmStringIR;
+ AsmString = std::move(AsmStringIR);
return false;
}
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp
index df1b160f9df28e..5703cfd03fcebc 100644
--- a/llvm/lib/MC/MCStreamer.cpp
+++ b/llvm/lib/MC/MCStreamer.cpp
@@ -463,7 +463,7 @@ void MCStreamer::emitCFIStartProc(bool IsSimple, SMLoc Loc) {
}
FrameInfoStack.emplace_back(DwarfFrameInfos.size(), getCurrentSectionOnly());
- DwarfFrameInfos.push_back(Frame);
+ DwarfFrameInfos.push_back(std::move(Frame));
}
void MCStreamer::emitCFIStartProcImpl(MCDwarfFrameInfo &Frame) {
@@ -510,7 +510,7 @@ void MCStreamer::emitCFIDefCfa(int64_t Register, int64_t Offset, SMLoc Loc) {
MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
if (!CurFrame)
return;
- CurFrame->Instructions.push_back(Instruction);
+ CurFrame->Instructions.push_back(std::move(Instruction));
CurFrame->CurrentCfaRegister = static_cast<unsigned>(Register);
}
@@ -521,7 +521,7 @@ void MCStreamer::emitCFIDefCfaOffset(int64_t Offset, SMLoc Loc) {
MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
if (!CurFrame)
return;
- CurFrame->Instructions.push_back(Instruction);
+ CurFrame->Instructions.push_back(std::move(Instruction));
}
void MCStreamer::emitCFIAdjustCfaOffset(int64_t Adjustment, SMLoc Loc) {
@@ -531,7 +531,7 @@ void MCStreamer::emitCFIAdjustCfaOffset(int64_t Adjustment, SMLoc Loc) {
MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
if (!CurFrame)
return;
- CurFrame->Instructions.push_back(Instruction);
+ CurFrame->Instructions.push_back(std::move(Instruction));
}
void MCStreamer::emitCFIDefCfaRegister(int64_t Register, SMLoc Loc) {
@@ -541,7 +541,7 @@ void MCStreamer::emitCFIDefCfaRegister(int64_t Register, SMLoc Loc) {
MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
if (!CurFrame)
return;
- CurFrame->Instructions.push_back(Instruction);
+ CurFrame->Instructions.push_back(std::move(Instruction));
CurFrame->CurrentCfaRegister = static_cast<unsigned>(Register);
}
@@ -553,7 +553,7 @@ void MCStreamer::emitCFILLVMDefAspaceCfa(int64_t Register, int64_t Offset,
MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
if (!CurFrame)
return;
- CurFrame->Instructions.push_back(Instruction);
+ CurFrame->Instructions.push_back(std::move(Instruction));
CurFrame->CurrentCfaRegister = static_cast<unsigned>(Register);
}
@@ -564,7 +564,7 @@ void MCStreamer::emitCFIOffset(int64_t Register, int64_t Offset, SMLoc Loc) {
MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
if (!CurFrame)
return;
- CurFrame->Instructions.push_back(Instruction);
+ CurFrame->Instructions.push_back(std::move(Instruction));
}
void MCStreamer::emitCFIRelOffset(int64_t Register, int64_t Offset, SMLoc Loc) {
@@ -574,7 +574,7 @@ void MCStreamer::emitCFIRelOffset(int64_t Register, int64_t Offset, SMLoc Loc) {
MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
if (!CurFrame)
return;
- CurFrame->Instructions.push_back(Instruction);
+ CurFrame->Instructions.push_back(std::move(Instruction));
}
void MCStreamer::emitCFIPersonality(const MCSymbol *Sym,
@@ -601,7 +601,7 @@ void MCStreamer::emitCFIRememberState(SMLoc Loc) {
MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
if (!CurFrame)
return;
- CurFrame->Instructions.push_back(Instruction);
+ CurFrame->Instructions.push_back(std::move(Instruction));
}
void MCStreamer::emitCFIRestoreState(SMLoc Loc) {
@@ -612,7 +612,7 @@ void MCStreamer::emitCFIRestoreState(SMLoc Loc) {
MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
if (!CurFrame)
return;
- CurFrame->Instructions.push_back(Instruction);
+ CurFrame->Instructions.push_back(std::move(Instruction));
}
void MCStreamer::emitCFISameValue(int64_t Register, SMLoc Loc) {
@@ -622,7 +622,7 @@ void MCStreamer::emitCFISameValue(int64_t Register, SMLoc Loc) {
MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
if (!CurFrame)
return;
- CurFrame->Instructions.push_back(Instruction);
+ CurFrame->Instructions.push_back(std::move(Instruction));
}
void MCStreamer::emitCFIRestore(int64_t Register, SMLoc Loc) {
@@ -632,7 +632,7 @@ void MCStreamer::emitCFIRestore(int64_t Register, SMLoc Loc) {
MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
if (!CurFrame)
return;
- CurFrame->Instructions.push_back(Instruction);
+ CurFrame->Instructions.push_back(std::move(Instruction));
}
void MCStreamer::emitCFIEscape(StringRef Values, SMLoc Loc) {
@@ -642,7 +642,7 @@ void MCStreamer::emitCFIEscape(StringRef Values, SMLoc Loc) {
MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
if (!CurFrame)
return;
- CurFrame->Instructions.push_back(Instruction);
+ CurFrame->Instructions.push_back(std::move(Instruction));
}
void MCStreamer::emitCFIGnuArgsSize(int64_t Size, SMLoc Loc) {
@@ -652,7 +652,7 @@ void MCStreamer::emitCFIGnuArgsSize(int64_t Size, SMLoc Loc) {
MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
if (!CurFrame)
return;
- CurFrame->Instructions.push_back(Instruction);
+ CurFrame->Instructions.push_back(std::move(Instruction));
}
void MCStreamer::emitCFISignalFrame() {
@@ -669,7 +669,7 @@ void MCStreamer::emitCFIUndefined(int64_t Register, SMLoc Loc) {
MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
if (!CurFrame)
return;
- CurFrame->Instructions.push_back(Instruction);
+ CurFrame->Instructions.push_back(std::move(Instruction));
}
void MCStreamer::emitCFIRegister(int64_t Register1, int64_t Register2,
@@ -680,7 +680,7 @@ void MCStreamer::emitCFIRegister(int64_t Register1, int64_t Register2,
MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
if (!CurFrame)
return;
- CurFrame->Instructions.push_back(Instruction);
+ CurFrame->Instructions.push_back(std::move(Instruction));
}
void MCStreamer::emitCFIWindowSave(SMLoc Loc) {
@@ -689,7 +689,7 @@ void MCStreamer::emitCFIWindowSave(SMLoc Loc) {
MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
if (!CurFrame)
return;
- CurFrame->Instructions.push_back(Instruction);
+ CurFrame->Instructions.push_back(std::move(Instruction));
}
void MCStreamer::emitCFINegateRAState(SMLoc Loc) {
@@ -699,7 +699,7 @@ void MCStreamer::emitCFINegateRAState(SMLoc Loc) {
MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
if (!CurFrame)
return;
- CurFrame->Instructions.push_back(Instruction);
+ CurFrame->Instructions.push_back(std::move(Instruction));
}
void MCStreamer::emitCFINegateRAStateWithPC(SMLoc Loc) {
@@ -709,7 +709,7 @@ void MCStreamer::emitCFINegateRAStateWithPC(SMLoc Loc) {
MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
if (!CurFrame)
return;
- CurFrame->Instructions.push_back(Instruction);
+ CurFrame->Instructions.push_back(std::move(Instruction));
}
void MCStreamer::emitCFIReturnColumn(int64_t Register) {
@@ -733,7 +733,7 @@ void MCStreamer::emitCFIValOffset(int64_t Register, int64_t Offset, SMLoc Loc) {
MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
if (!CurFrame)
return;
- CurFrame->Instructions.push_back(Instruction);
+ CurFrame->Instructions.push_back(std::move(Instruction));
}
WinEH::FrameInfo *MCStreamer::EnsureValidWinFrameInfo(SMLoc Loc) {
diff --git a/llvm/lib/Target/X86/X86TileConfig.cpp b/llvm/lib/Target/X86/X86TileConfig.cpp
index 75f002f418ba6d..c054b267278551 100644
--- a/llvm/lib/Target/X86/X86TileConfig.cpp
+++ b/llvm/lib/Target/X86/X86TileConfig.cpp
@@ -103,7 +103,7 @@ static void collectVirtRegShapes(MachineRegisterInfo *MRI, VirtRegMap &VRM,
unsigned Index = PhysReg - X86::TMM0;
if (!Phys2Shapes[Index].isValid()) {
ShapeT Shape = VRM.getShape(VirtReg);
- Phys2Shapes[Index] = Shape;
+ Phys2Shapes[Index] = std::move(Shape);
return;
}
}
@@ -118,12 +118,12 @@ static void collectVirtRegShapes(MachineRegisterInfo *MRI, VirtRegMap &VRM,
if (!Phys2Shapes[Index0].isValid()) {
ShapeT Shape0(Shape.getRow(0), Shape.getCol(0), MRI);
- Phys2Shapes[Index0] = Shape0;
+ Phys2Shapes[Index0] = std::move(Shape0);
}
if (!Phys2Shapes[Index1].isValid()) {
ShapeT Shape1(Shape.getRow(1), Shape.getCol(1), MRI);
- Phys2Shapes[Index1] = Shape1;
+ Phys2Shapes[Index1] = std::move(Shape1);
}
}
}
More information about the llvm-commits
mailing list