[PATCH] D152399: [CodeGen] Fine tune MachineFunctionSplitPass (MFS) for FSAFDO.

Snehasish Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 26 13:21:02 PDT 2023


snehasish added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineFunctionSplitter.cpp:169
     PSI = &getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI();
+    // If we do not have AccurateProfile, we only trust hot
+    // functions, which have many samples, and consider them as
----------------
nit: accurate profile 
or HasAccurateProfile if you want to refer to the flag.

Same below.


================
Comment at: llvm/lib/CodeGen/MachineFunctionSplitter.cpp:171
+    // functions, which have many samples, and consider them as
+    // split candidates. On the otherhand, if we do have
+    // AccurateProfile (like IRPGO), we trust both cold and hot
----------------
nit: other hand


================
Comment at: llvm/lib/CodeGen/MachineFunctionSplitter.cpp:232
+llvm::createMachineFunctionSplitterPass(bool HasAccurateProfile) {
+  return new MachineFunctionSplitter(HasAccurateProfile);
 }
----------------
Do we need to pass this in explicitly anymore? Can we instead infer this locally from ProfileSummaryInfo in runOnMachineFunction? 

I think the following is equivalent to the current behaviour

```
bool HasAccurateProfile = PSI->hasInstrumentationProfile() || PSI->hasCSInstrumentationProfile(); 
```


================
Comment at: llvm/test/CodeGen/X86/machine-function-splitter.ll:442
+!26 = !{!"branch_weights", i32 1000, i32 6000}
\ No newline at end of file

----------------
nit: add newline


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152399



More information about the llvm-commits mailing list