[llvm] ce294ff - MachineCSE.cpp - use auto const& iterator in for-range loop to avoid copies. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 08:56:03 PDT 2020


Author: Simon Pilgrim
Date: 2020-09-21T16:54:26+01:00
New Revision: ce294ff8cddf110cefd5955cf30c575c7838b452

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

LOG: MachineCSE.cpp - use auto const& iterator in for-range loop to avoid copies. NFCI.

Added: 
    

Modified: 
    llvm/lib/CodeGen/MachineCSE.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/MachineCSE.cpp b/llvm/lib/CodeGen/MachineCSE.cpp
index 09531276bc10..d3eca3ac4128 100644
--- a/llvm/lib/CodeGen/MachineCSE.cpp
+++ b/llvm/lib/CodeGen/MachineCSE.cpp
@@ -777,11 +777,11 @@ bool MachineCSE::isPRECandidate(MachineInstr *MI) {
       MI->getNumExplicitDefs() != 1)
     return false;
 
-  for (auto def : MI->defs())
+  for (const auto &def : MI->defs())
     if (!Register::isVirtualRegister(def.getReg()))
       return false;
 
-  for (auto use : MI->uses())
+  for (const auto &use : MI->uses())
     if (use.isReg() && !Register::isVirtualRegister(use.getReg()))
       return false;
 


        


More information about the llvm-commits mailing list