[llvm] 550b1a6 - [AsmPrinter] DwarfDebug - use DebugLoc const references where possible. NFC.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 17 03:15:37 PDT 2020
Author: Simon Pilgrim
Date: 2020-09-17T10:45:54+01:00
New Revision: 550b1a6fd46f59134b2629ce23ca6a7874b45585
URL: https://github.com/llvm/llvm-project/commit/550b1a6fd46f59134b2629ce23ca6a7874b45585
DIFF: https://github.com/llvm/llvm-project/commit/550b1a6fd46f59134b2629ce23ca6a7874b45585.diff
LOG: [AsmPrinter] DwarfDebug - use DebugLoc const references where possible. NFC.
Avoid unnecessary copies.
Added:
Modified:
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 5a97e321ab1a..94bf94c296cb 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -218,8 +218,8 @@ static DbgValueLoc getDebugLocValue(const MachineInstr *MI) {
const DIExpression *Expr = MI->getDebugExpression();
assert(MI->getNumOperands() == 4);
if (MI->getDebugOperand(0).isReg()) {
- auto RegOp = MI->getDebugOperand(0);
- auto Op1 = MI->getDebugOffset();
+ const auto &RegOp = MI->getDebugOperand(0);
+ const auto &Op1 = MI->getDebugOffset();
// If the second operand is an immediate, this is a
// register-indirect address.
assert((!Op1.isImm() || (Op1.getImm() == 0)) && "unexpected offset");
@@ -227,7 +227,7 @@ static DbgValueLoc getDebugLocValue(const MachineInstr *MI) {
return DbgValueLoc(Expr, MLoc);
}
if (MI->getDebugOperand(0).isTargetIndex()) {
- auto Op = MI->getDebugOperand(0);
+ const auto &Op = MI->getDebugOperand(0);
return DbgValueLoc(Expr,
TargetIndexLocation(Op.getIndex(), Op.getOffset()));
}
@@ -2506,7 +2506,7 @@ void DebugLocEntry::finalize(const AsmPrinter &AP,
}) && "all values are expected to be fragments");
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);
} else {
More information about the llvm-commits
mailing list