[PATCH] D57082: [HotColdSplit] Move splitting earlier in the pipeline

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 23 07:03:25 PST 2019


tejohnson added inline comments.


================
Comment at: llvm/lib/Passes/PassBuilder.cpp:661
 
+  if (EnableHotColdSplit && Phase != ThinLTOPhase::PostLink)
+    MPM.addPass(HotColdSplittingPass());
----------------
Probably should have similar comment about why here (like you added in old PM).


================
Comment at: llvm/lib/Transforms/IPO/PassManagerBuilder.cpp:521
+  // accurate, but before InstCombine to allow it to clean things up.
+  if (EnableHotColdSplit && !PrepareForLTO && !PrepareForThinLTO)
+    MPM.add(createHotColdSplittingPass());
----------------
I think you have the wrong LTO guards. This is the opposite of the ThinLTO guard you have in the new PM. Here you are preventing this from running during the ThinLTO (and regular LTO) pre-link steps. The following are equivalent:
   PrepareForThinLTO (oldPM) == ThinLTOPhase::PreLink (newPM)
   PerformThinLTO (oldPM) == ThinLTOPhase::PostLink (newPM)

Note that there is no PerformLTO, since in the old PM this function is not even called during the regular LTO post link (which has a different, specialized pipeline). So in a nutshell, I believe this should be:

   if (EnableHotColdSplit && !PerformThinLTO)

This will give you splitting during a non-LTO compile, and during the pre-link *LTO compiles.



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

https://reviews.llvm.org/D57082





More information about the llvm-commits mailing list