[PATCH] D125743: [outliner] Use profile data to avoid outlining hot blocks

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 8 12:24:41 PDT 2022


wenlei added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineOutliner.cpp:119
+static cl::opt<bool>
+    UseProfileData("machine-outliner-use-profile-data", cl::init(false),
+                   cl::Hidden,
----------------
I don't think we do this for other passes. Once the plumbing for BFI/MBFI is done for passes to leverage profile info, we just always do that. Using profile should indeed always be better if heuristic is reasonable. Why you need a flag for this case? 

If you need some confidence in profile quality, you can check on profile (`PSI->hasInstrumentationProfile()`) etc.


================
Comment at: llvm/lib/CodeGen/MachineOutliner.cpp:379
+    if (UseProfileData) {
+      AU.addRequired<BlockFrequencyInfoWrapperPass>();
+      AU.addRequired<ProfileSummaryInfoWrapperPass>();
----------------
Why do we require BFI instead of MBFI given this is dealing with MIR.


================
Comment at: llvm/lib/CodeGen/MachineOutliner.cpp:943
+        continue;
+      // TODO: Should we use isHotBlockNthPercentile() instead?
+
----------------
Usually we call higher level API like isHotBlock instead of isHotBlockNthPercentile. You can tweak the global percentile by `-profile-summary-cutoff-hot`. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125743



More information about the llvm-commits mailing list