[PATCH] D155253: [CodeGen] Separate MachineFunctionSplitter logic for different profile types

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 13 18:40:37 PDT 2023


wenlei added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineFunctionSplitter.cpp:112
   std::optional<uint64_t> Count = MBFI->getBlockProfileCount(&MBB);
-  // If using accurate profile, no count means cold.
-  // If no accurate profile, no count means "do not judge
-  // coldness".
-  if (!Count)
-    return HasAccurateProfile;
-
-  if (PercentileCutoff > 0)
-    return PSI->isColdCountNthPercentile(PercentileCutoff, *Count);
-  return (*Count < ColdCountThreshold);
+  switch (ProfileKind) {
+  case ProfileSummary::PSK_Instr:
----------------
Can we just use query PSI directly? PSI has the following API, which should be sufficient and we should be able to avoid passing `ProfileKind` around. 

```
PSI->hasSampleProfile()
PSI->hasInstrumentationProfile()
PSI->hasCSInstrumentationProfile() 
```


================
Comment at: llvm/lib/CodeGen/MachineFunctionSplitter.cpp:126
+      return false;
+    return *Count < ColdCountThreshold;
+  }
----------------
This is common code that can be sinked out of the switch. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155253



More information about the llvm-commits mailing list