[PATCH] D67377: [PGO][PGSO] ProfileSummary changes.

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 14:28:28 PDT 2019


davidxl added inline comments.


================
Comment at: llvm/lib/Analysis/ProfileSummaryInfo.cpp:274
+      getEntryForPercentile(DetailedSummary, PercentileCutoff);
+  auto CountThreshold = Optional<uint64_t>(Entry.MinCount);
+  if (ThresholdCache.size() >= MaxThresholdCacheSize)
----------------
Why Optional?


================
Comment at: llvm/lib/Analysis/ProfileSummaryInfo.cpp:275
+  auto CountThreshold = Optional<uint64_t>(Entry.MinCount);
+  if (ThresholdCache.size() >= MaxThresholdCacheSize)
+    ThresholdCache.clear();
----------------
since illegal PercentilCutoff will result in assertion, there seems no need to cap the cache.


================
Comment at: llvm/lib/Analysis/ProfileSummaryInfo.cpp:277
+    ThresholdCache.clear();
+  ThresholdCache.insert(std::make_pair(PercentileCutoff, CountThreshold));
+  return CountThreshold;
----------------
Since you are not checking insert status, it is cleaner to use

ThresholdCache[PercentileCutoff] = CountThreshold;


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67377/new/

https://reviews.llvm.org/D67377





More information about the llvm-commits mailing list