[PATCH] D13454: [RewriteStatepointsForGC] Don't copy ADT's unneccessarily, NFCI

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 5 17:18:43 PDT 2015


sanjoy created this revision.
sanjoy added reviewers: reames, swaroop.sridhar.
sanjoy added a subscriber: llvm-commits.

Use `const auto &` instead of `auto` in `makeStatepointExplicit`.

http://reviews.llvm.org/D13454

Files:
  lib/Transforms/Scalar/RewriteStatepointsForGC.cpp

Index: lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
===================================================================
--- lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
+++ lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
@@ -1505,17 +1505,17 @@
 static void
 makeStatepointExplicit(DominatorTree &DT, const CallSite &CS,
                        PartiallyConstructedSafepointRecord &Result) {
-  auto LiveSet = Result.LiveSet;
-  auto PointerToBase = Result.PointerToBase;
+  const auto &LiveSet = Result.LiveSet;
+  const auto &PointerToBase = Result.PointerToBase;
 
   // Convert to vector for efficient cross referencing.
   SmallVector<Value *, 64> BaseVec, LiveVec;
   LiveVec.reserve(LiveSet.size());
   BaseVec.reserve(LiveSet.size());
   for (Value *L : LiveSet) {
     LiveVec.push_back(L);
     assert(PointerToBase.count(L));
-    Value *Base = PointerToBase[L];
+    Value *Base = PointerToBase.find(L)->second;
     BaseVec.push_back(Base);
   }
   assert(LiveVec.size() == BaseVec.size());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13454.36572.patch
Type: text/x-patch
Size: 1016 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151006/be7f37bc/attachment.bin>


More information about the llvm-commits mailing list