[PATCH] D21771: [OptRemark] RFC: Add hotness attribute

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 5 14:33:19 PDT 2016

hfinkel added a comment.

Thanks for working on this.

Is there a reason that these should be free functions instead of just making an Analysis pass with these as member functions? Making it an actual analysis will make it easy to require BFI. I think the "get if available" will end up being confusing (sometimes the filtering will work, sometimes not, depending on what gets invalidated when - especially with the new pass manager where this will be dynamic). Side note: We might want to make BFI lazy (or compute-on-first-query instead of actually computing things in runOnFunction).

Comment at: include/llvm/IR/DiagnosticInfo.h:426
@@ -416,1 +425,3 @@
+  /// instrumentation run.  If profile informatin is not avaiable, this zero.
+  uint64_t Hotness;
I think that we should differentiate between 0 and "no information". Maybe make this an Optional<uint64_t>?

Comment at: lib/Analysis/OptimizationDiagnosticInfo.cpp:27
@@ +26,3 @@
+  return BFI->getBFI().getBlockProfileCount(cast<BasicBlock>(V)).getValueOr(0);
V might not always be a BB. This is something you were planning to generalize later?


More information about the llvm-commits mailing list