[llvm] 81a4088 - [Scalar] ConstantHoistingPass - iterate with const references. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 10:41:06 PDT 2020


Author: Simon Pilgrim
Date: 2020-09-24T18:40:50+01:00
New Revision: 81a408808f668c74ada3a1ed3d55f1feef334872

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

LOG: [Scalar] ConstantHoistingPass - iterate with const references. NFCI.

Fix some clang-tidy warnings.

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/ConstantHoisting.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp b/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
index b3dfb7fe2463..fdab74fc94c5 100644
--- a/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
+++ b/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
@@ -951,7 +951,7 @@ bool ConstantHoistingPass::runImpl(Function &Fn, TargetTransformInfo &TTI,
   // base constant.
   if (!ConstIntCandVec.empty())
     findBaseConstants(nullptr);
-  for (auto &MapEntry : ConstGEPCandMap)
+  for (const auto &MapEntry : ConstGEPCandMap)
     if (!MapEntry.second.empty())
       findBaseConstants(MapEntry.first);
 
@@ -960,7 +960,7 @@ bool ConstantHoistingPass::runImpl(Function &Fn, TargetTransformInfo &TTI,
   bool MadeChange = false;
   if (!ConstIntInfoVec.empty())
     MadeChange = emitBaseConstants(nullptr);
-  for (auto MapEntry : ConstGEPInfoMap)
+  for (const auto &MapEntry : ConstGEPInfoMap)
     if (!MapEntry.second.empty())
       MadeChange |= emitBaseConstants(MapEntry.first);
 


        


More information about the llvm-commits mailing list