[llvm] 5cabe4d - [CodeGen] RegisterCoalescer::buildVRegToDbgValueMap - use const-ref value in for-range loop. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 23 04:25:56 PDT 2021
Author: Simon Pilgrim
Date: 2021-09-23T12:23:45+01:00
New Revision: 5cabe4d9d3226bfd0856ac031b63ab641acc08f5
URL: https://github.com/llvm/llvm-project/commit/5cabe4d9d3226bfd0856ac031b63ab641acc08f5
DIFF: https://github.com/llvm/llvm-project/commit/5cabe4d9d3226bfd0856ac031b63ab641acc08f5.diff
LOG: [CodeGen] RegisterCoalescer::buildVRegToDbgValueMap - use const-ref value in for-range loop. NFCI.
Avoid unnecessary copies, reported by MSVC static analyzer.
Added:
Modified:
llvm/lib/CodeGen/RegisterCoalescer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/RegisterCoalescer.cpp b/llvm/lib/CodeGen/RegisterCoalescer.cpp
index 751f79e66b73..582ad35f8da9 100644
--- a/llvm/lib/CodeGen/RegisterCoalescer.cpp
+++ b/llvm/lib/CodeGen/RegisterCoalescer.cpp
@@ -3708,7 +3708,7 @@ void RegisterCoalescer::buildVRegToDbgValueMap(MachineFunction &MF)
// vreg => DbgValueLoc map.
auto CloseNewDVRange = [this, &ToInsert](SlotIndex Slot) {
for (auto *X : ToInsert) {
- for (auto Op : X->debug_operands()) {
+ for (const auto &Op : X->debug_operands()) {
if (Op.isReg() && Op.getReg().isVirtual())
DbgVRegToValues[Op.getReg()].push_back({Slot, X});
}
More information about the llvm-commits
mailing list