Skip to content

Commit 3e806c8

Browse files
authored
[NFC] Use references to avoid copying (#99863)
Modifying `auto` to `auto&` to avoid unnecessary copying
1 parent fc4485b commit 3e806c8

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

llvm/include/llvm/CodeGen/MachineInstrBuilder.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,10 +537,10 @@ MachineInstr *buildDbgValueForSpill(MachineBasicBlock &BB,
537537
MachineBasicBlock::iterator I,
538538
const MachineInstr &Orig, int FrameIndex,
539539
Register SpillReg);
540-
MachineInstr *
541-
buildDbgValueForSpill(MachineBasicBlock &BB, MachineBasicBlock::iterator I,
542-
const MachineInstr &Orig, int FrameIndex,
543-
SmallVectorImpl<const MachineOperand *> &SpilledOperands);
540+
MachineInstr *buildDbgValueForSpill(
541+
MachineBasicBlock &BB, MachineBasicBlock::iterator I,
542+
const MachineInstr &Orig, int FrameIndex,
543+
const SmallVectorImpl<const MachineOperand *> &SpilledOperands);
544544

545545
/// Update a DBG_VALUE whose value has been spilled to FrameIndex. Useful when
546546
/// modifying an instruction in place while iterating over a basic block.

llvm/lib/CodeGen/MachineInstr.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2296,9 +2296,9 @@ MachineInstrBuilder llvm::BuildMI(MachineBasicBlock &BB,
22962296

22972297
/// Compute the new DIExpression to use with a DBG_VALUE for a spill slot.
22982298
/// This prepends DW_OP_deref when spilling an indirect DBG_VALUE.
2299-
static const DIExpression *
2300-
computeExprForSpill(const MachineInstr &MI,
2301-
SmallVectorImpl<const MachineOperand *> &SpilledOperands) {
2299+
static const DIExpression *computeExprForSpill(
2300+
const MachineInstr &MI,
2301+
const SmallVectorImpl<const MachineOperand *> &SpilledOperands) {
23022302
assert(MI.getDebugVariable()->isValidLocationForIntrinsic(MI.getDebugLoc()) &&
23032303
"Expected inlined-at fields to agree");
23042304

@@ -2353,7 +2353,7 @@ MachineInstr *llvm::buildDbgValueForSpill(MachineBasicBlock &BB,
23532353
MachineInstr *llvm::buildDbgValueForSpill(
23542354
MachineBasicBlock &BB, MachineBasicBlock::iterator I,
23552355
const MachineInstr &Orig, int FrameIndex,
2356-
SmallVectorImpl<const MachineOperand *> &SpilledOperands) {
2356+
const SmallVectorImpl<const MachineOperand *> &SpilledOperands) {
23572357
const DIExpression *Expr = computeExprForSpill(Orig, SpilledOperands);
23582358
MachineInstrBuilder NewMI =
23592359
BuildMI(BB, I, Orig.getDebugLoc(), Orig.getDesc());

llvm/lib/CodeGen/RegAllocFast.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ void RegAllocFastImpl::spill(MachineBasicBlock::iterator Before,
584584
SpilledOperandsMap;
585585
for (MachineOperand *MO : LRIDbgOperands)
586586
SpilledOperandsMap[MO->getParent()].push_back(MO);
587-
for (auto MISpilledOperands : SpilledOperandsMap) {
587+
for (const auto &MISpilledOperands : SpilledOperandsMap) {
588588
MachineInstr &DBG = *MISpilledOperands.first;
589589
// We don't have enough support for tracking operands of DBG_VALUE_LISTs.
590590
if (DBG.isDebugValueList())

0 commit comments

Comments
 (0)