[PATCH] D60154: [PGO] Better handling of profile hash mismatch

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 10 10:09:55 PDT 2019


davidxl added inline comments.


================
Comment at: lib/Transforms/Instrumentation/PGOInstrumentation.cpp:1010
   // Find the Instrumented BB and set the value.
-  void setInstrumentedCounts(const std::vector<uint64_t> &CountFromProfile);
+  bool setInstrumentedCounts(const std::vector<uint64_t> &CountFromProfile);
 
----------------
update the comments about the return value.


================
Comment at: lib/Transforms/Instrumentation/PGOInstrumentation.cpp:1042
     const std::vector<uint64_t> &CountFromProfile) {
-  assert(FuncInfo.getNumCounters() == CountFromProfile.size());
+  if (FuncInfo.getNumCounters() != CountFromProfile.size()) {
+    return false;
----------------
document on how this can happen. 




================
Comment at: lib/Transforms/Instrumentation/PGOInstrumentation.cpp:1155
+        dbgs() << "Inconsistent number of counts in, skipping this function");
+    Ctx.diagnose(DiagnosticInfoPGOProfile(
+        M->getName().data(),
----------------
What is the possible cause of it? It is better emit the information so that users can take some actions -- otherwise the message is not useful.


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

https://reviews.llvm.org/D60154





More information about the llvm-commits mailing list