[llvm] 2a5936f - [CodeGen] ProcessSDDbgValues - 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:58 PDT 2021


Author: Simon Pilgrim
Date: 2021-09-23T12:23:46+01:00
New Revision: 2a5936faf0f3da9f55109ac1ed3b7b45436e3ced

URL: https://github.com/llvm/llvm-project/commit/2a5936faf0f3da9f55109ac1ed3b7b45436e3ced
DIFF: https://github.com/llvm/llvm-project/commit/2a5936faf0f3da9f55109ac1ed3b7b45436e3ced.diff

LOG: [CodeGen] ProcessSDDbgValues - use const-ref value in for-range loop. NFCI.

Avoid unnecessary copies, reported by MSVC static analyzer.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
index b2a8c8bdd78c..453ea8105213 100644
--- a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
@@ -742,7 +742,7 @@ ProcessSDDbgValues(SDNode *N, SelectionDAG *DAG, InstrEmitter &Emitter,
   /// Returns true if \p DV has any VReg operand locations which don't exist in
   /// VRBaseMap.
   auto HasUnknownVReg = [&VRBaseMap](SDDbgValue *DV) {
-    for (SDDbgOperand L : DV->getLocationOps()) {
+    for (const SDDbgOperand &L : DV->getLocationOps()) {
       if (L.getKind() == SDDbgOperand::SDNODE &&
           VRBaseMap.count({L.getSDNode(), L.getResNo()}) == 0)
         return true;


        


More information about the llvm-commits mailing list