[AsmPrinter] DwarfDebug - use DebugLoc const references where possible. NFC.

Avoid unnecessary copies.
This commit is contained in:
Simon Pilgrim 2020-09-16 19:02:20 +01:00
parent 8adf92e2d1
commit 550b1a6fd4
1 changed files with 4 additions and 4 deletions

View File

@ -218,8 +218,8 @@ static DbgValueLoc getDebugLocValue(const MachineInstr *MI) {
const DIExpression *Expr = MI->getDebugExpression(); const DIExpression *Expr = MI->getDebugExpression();
assert(MI->getNumOperands() == 4); assert(MI->getNumOperands() == 4);
if (MI->getDebugOperand(0).isReg()) { if (MI->getDebugOperand(0).isReg()) {
auto RegOp = MI->getDebugOperand(0); const auto &RegOp = MI->getDebugOperand(0);
auto Op1 = MI->getDebugOffset(); const auto &Op1 = MI->getDebugOffset();
// If the second operand is an immediate, this is a // If the second operand is an immediate, this is a
// register-indirect address. // register-indirect address.
assert((!Op1.isImm() || (Op1.getImm() == 0)) && "unexpected offset"); assert((!Op1.isImm() || (Op1.getImm() == 0)) && "unexpected offset");
@ -227,7 +227,7 @@ static DbgValueLoc getDebugLocValue(const MachineInstr *MI) {
return DbgValueLoc(Expr, MLoc); return DbgValueLoc(Expr, MLoc);
} }
if (MI->getDebugOperand(0).isTargetIndex()) { if (MI->getDebugOperand(0).isTargetIndex()) {
auto Op = MI->getDebugOperand(0); const auto &Op = MI->getDebugOperand(0);
return DbgValueLoc(Expr, return DbgValueLoc(Expr,
TargetIndexLocation(Op.getIndex(), Op.getOffset())); TargetIndexLocation(Op.getIndex(), Op.getOffset()));
} }
@ -2506,7 +2506,7 @@ void DebugLocEntry::finalize(const AsmPrinter &AP,
}) && "all values are expected to be fragments"); }) && "all values are expected to be fragments");
assert(llvm::is_sorted(Values) && "fragments are expected to be sorted"); assert(llvm::is_sorted(Values) && "fragments are expected to be sorted");
for (auto Fragment : Values) for (const auto &Fragment : Values)
DwarfDebug::emitDebugLocValue(AP, BT, Fragment, DwarfExpr); DwarfDebug::emitDebugLocValue(AP, BT, Fragment, DwarfExpr);
} else { } else {