[NFC][MachineInstr] Pass-by-value DebugLoc in CreateMachineInstr

DebugLoc is cheap to move, passing it by-val rather than const ref to
take advantage of the fact that it is consumed that way by the
MachineInstr ctor, which creates some optimization oportunities.

Differential Revision: https://reviews.llvm.org/D115208
This commit is contained in:
Mircea Trofin 2021-12-06 17:33:13 -08:00
parent 02095f2dd7
commit 2bd7384d3a
2 changed files with 3 additions and 3 deletions

View File

@ -890,7 +890,7 @@ public:
/// CreateMachineInstr - Allocate a new MachineInstr. Use this instead
/// of `new MachineInstr'.
MachineInstr *CreateMachineInstr(const MCInstrDesc &MCID, const DebugLoc &DL,
MachineInstr *CreateMachineInstr(const MCInstrDesc &MCID, DebugLoc DL,
bool NoImplicit = false);
/// Create a new MachineInstr which is a copy of \p Orig, identical in all

View File

@ -350,10 +350,10 @@ void MachineFunction::assignBeginEndSections() {
/// Allocate a new MachineInstr. Use this instead of `new MachineInstr'.
MachineInstr *MachineFunction::CreateMachineInstr(const MCInstrDesc &MCID,
const DebugLoc &DL,
DebugLoc DL,
bool NoImplicit) {
return new (InstructionRecycler.Allocate<MachineInstr>(Allocator))
MachineInstr(*this, MCID, DL, NoImplicit);
MachineInstr(*this, MCID, std::move(DL), NoImplicit);
}
/// Create a new MachineInstr which is a copy of the 'Orig' instruction,