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

Han Shen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 24 11:36:35 PDT 2023


shenhan added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineFunctionSplitter.cpp:182-188
+  if (!CandidateForSplit) {
+    // Split all EH code and it's descendant statically by default.
+    if (SplitAllEHCode)
+      setDescendantEHBlocksCold(MF);
+    finishAdjustingBasicBlocksAndLandingPads(MF);
+    return true;
   }
----------------
wenlei wrote:
> Does this change the behavior for UseProfileData == false, even if HasAccurateProfile == true? 
> 
> Can we move this up to line 177, and do the following directly?
> 
> ```
> if (UseProfileData) {
>   MBFI = &getAnalysis<MachineBlockFrequencyInfo>();
>   PSI = &getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI();
>   // Comments ..
>   if (!HasAccurateProfile && !PSI->isFunctionHotInCallGraph(&MF.getFunction(), MBFI)) {
>     // Split all EH code and it's descendant statically by default.
>     if (SplitAllEHCode)
>       setDescendantEHBlocksCold(MF);
>     finishAdjustingBasicBlocksAndLandingPads(MF);
>     return true;
>   }
> }
> ```
> 
> 
> Does this change the behavior for UseProfileData == false, even if HasAccurateProfile == true?

Actually no. When UseProfileData == false, candidateForSplit will always be false (regardless of what HasAccurateProfile is),  so it will trigger an early return in code block 182.

> Can we move this up to line 177, and do the following directly?
Yes, this reads more nature.







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