diff --git a/llvm/include/llvm/CodeGen/MachineInstr.h b/llvm/include/llvm/CodeGen/MachineInstr.h --- a/llvm/include/llvm/CodeGen/MachineInstr.h +++ b/llvm/include/llvm/CodeGen/MachineInstr.h @@ -267,7 +267,7 @@ /// This constructor create a MachineInstr and add the implicit operands. /// It reserves space for number of operands specified by /// MCInstrDesc. An explicit DebugLoc is supplied. - MachineInstr(MachineFunction &, const MCInstrDesc &TID, DebugLoc DL, + MachineInstr(MachineFunction &, const MCInstrDesc &TID, const DebugLoc &DL, bool NoImp = false); // MachineInstrs are pool-allocated and owned by MachineFunction. @@ -1737,8 +1737,8 @@ /// Replace current source information with new such. /// Avoid using this, the constructor argument is preferable. - void setDebugLoc(DebugLoc DL) { - DbgLoc = std::move(DL); + void setDebugLoc(const DebugLoc &DL) { + DbgLoc = DL; assert(DbgLoc.hasTrivialDestructor() && "Expected trivial destructor"); } diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -116,8 +116,8 @@ /// implicit operands. It reserves space for the number of operands specified by /// the MCInstrDesc. MachineInstr::MachineInstr(MachineFunction &MF, const MCInstrDesc &TID, - DebugLoc DL, bool NoImp) - : MCID(&TID), DbgLoc(std::move(DL)), DebugInstrNum(0) { + const DebugLoc &DL, bool NoImp) + : MCID(&TID), DbgLoc(DL), DebugInstrNum(0) { assert(DbgLoc.hasTrivialDestructor() && "Expected trivial destructor"); // Reserve space for the expected number of operands.