RewriteStatepointsForGC - Use const-ref iterator in for-range loops. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 21 Sep 2021 09:14:02 +0000 (10:14 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 21 Sep 2021 12:01:08 +0000 (13:01 +0100)
Avoid unnecessary copies, reported by MSVC static analyzer.

llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp

index 095c70f..415269d 100644 (file)
@@ -910,7 +910,7 @@ static Value *findBasePointer(Value *I, DefiningValueMapTy &Cache) {
 #ifndef NDEBUG
   VerifyStates();
   LLVM_DEBUG(dbgs() << "States after initialization:\n");
-  for (auto Pair : States) {
+  for (const auto &Pair : States) {
     LLVM_DEBUG(dbgs() << " " << Pair.second << " for " << *Pair.first << "\n");
   }
 #endif
@@ -1002,7 +1002,7 @@ static Value *findBasePointer(Value *I, DefiningValueMapTy &Cache) {
 #ifndef NDEBUG
   VerifyStates();
   LLVM_DEBUG(dbgs() << "States after meet iteration:\n");
-  for (auto Pair : States) {
+  for (const auto &Pair : States) {
     LLVM_DEBUG(dbgs() << " " << Pair.second << " for " << *Pair.first << "\n");
   }
 #endif