[PATCH] D34694: llvm-profdata: Indirect infrequently used fields to reduce memory usage

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 14:55:46 PDT 2017


davidxl added inline comments.


================
Comment at: include/llvm/ProfileData/InstrProf.h:698
+  getValueSitesForKind(uint32_t ValueKind) {
+    auto AR = const_cast<const InstrProfRecord *>(this)->getValueSitesForKind(
+        ValueKind);
----------------
Is the const_cast here needed?  Non const pointer can be used with const method right?


================
Comment at: lib/ProfileData/InstrProf.cpp:511
+      getOrCreateValueSitesForKind(ValueKind);
   std::vector<InstrProfValueSiteRecord> &OtherSiteRecords =
+      Src.getOrCreateValueSitesForKind(ValueKind);
----------------
This one should use the read-only version of the API.


================
Comment at: lib/ProfileData/InstrProf.cpp:542
   std::vector<InstrProfValueSiteRecord> &ThisSiteRecords =
-      getValueSitesForKind(ValueKind);
+      getOrCreateValueSitesForKind(ValueKind);
   for (uint32_t I = 0; I < ThisNumValueSites; I++)
----------------
Should use the read-only version.


https://reviews.llvm.org/D34694





More information about the llvm-commits mailing list