[DebugCounters] don't do redundant map lookups; NFC
authorGeorge Burgess IV <george.burgess.iv@gmail.com>
Fri, 17 Aug 2018 22:34:04 +0000 (22:34 +0000)
committerGeorge Burgess IV <george.burgess.iv@gmail.com>
Fri, 17 Aug 2018 22:34:04 +0000 (22:34 +0000)
llvm-svn: 340104

llvm/lib/Support/DebugCounter.cpp

index 9c12de0..9c8260d 100644 (file)
@@ -83,8 +83,10 @@ void DebugCounter::push_back(const std::string &Val) {
       return;
     }
     enableAllCounters();
-    Counters[CounterID].Skip = CounterVal;
-    Counters[CounterID].IsSet = true;
+
+    CounterInfo &Counter = Counters[CounterID];
+    Counter.Skip = CounterVal;
+    Counter.IsSet = true;
   } else if (CounterPair.first.endswith("-count")) {
     auto CounterName = CounterPair.first.drop_back(6);
     unsigned CounterID = getCounterId(CounterName);
@@ -94,8 +96,10 @@ void DebugCounter::push_back(const std::string &Val) {
       return;
     }
     enableAllCounters();
-    Counters[CounterID].StopAfter = CounterVal;
-    Counters[CounterID].IsSet = true;
+
+    CounterInfo &Counter = Counters[CounterID];
+    Counter.StopAfter = CounterVal;
+    Counter.IsSet = true;
   } else {
     errs() << "DebugCounter Error: " << CounterPair.first
            << " does not end with -skip or -count\n";