[llvm] 20b5885 - [CodeGen] SelectionDAGBuilder - Use const-ref iterator in for-range loops. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 21 05:01:37 PDT 2021


Author: Simon Pilgrim
Date: 2021-09-21T13:01:08+01:00
New Revision: 20b58855e0cfc263d609e8bb59e692024ecb42aa

URL: https://github.com/llvm/llvm-project/commit/20b58855e0cfc263d609e8bb59e692024ecb42aa
DIFF: https://github.com/llvm/llvm-project/commit/20b58855e0cfc263d609e8bb59e692024ecb42aa.diff

LOG: [CodeGen] SelectionDAGBuilder - Use const-ref iterator in for-range loops. NFCI.

Avoid unnecessary copies, reported by MSVC static analyzer.

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 7bb3031d6f8e..6b09d39f8b90 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -1409,7 +1409,7 @@ bool SelectionDAGBuilder::handleDebugValue(ArrayRef<const Value *> Values,
           BitsToDescribe = *VarSize;
         if (auto Fragment = Expr->getFragmentInfo())
           BitsToDescribe = Fragment->SizeInBits;
-        for (auto RegAndSize : RFV.getRegsAndSizes()) {
+        for (const auto &RegAndSize : RFV.getRegsAndSizes()) {
           // Bail out if all bits are described already.
           if (Offset >= BitsToDescribe)
             break;
@@ -5629,7 +5629,7 @@ bool SelectionDAGBuilder::EmitFuncArgumentDbgValue(
     auto splitMultiRegDbgValue = [&](ArrayRef<std::pair<unsigned, TypeSize>>
                                          SplitRegs) {
       unsigned Offset = 0;
-      for (auto RegAndSize : SplitRegs) {
+      for (const auto &RegAndSize : SplitRegs) {
         // If the expression is already a fragment, the current register
         // offset+size might extend beyond the fragment. In this case, only
         // the register bits that are inside the fragment are relevant.


        


More information about the llvm-commits mailing list