[llvm] [Analysis] Use CycleInfo for BranchProbabilityInfo (PR #210301)

Alexis Engelke via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 17 05:34:34 PDT 2026


================
@@ -1084,7 +1085,9 @@ ModuleSummaryIndex llvm::buildModuleSummaryIndex(
       BFI = GetBFICallback(F);
     else if (F.hasProfileData()) {
       LoopInfo LI{DT};
-      BranchProbabilityInfo BPI{F, LI};
+      CycleInfo CI;
+      CI.compute(const_cast<Function &>(F));
+      BranchProbabilityInfo BPI{F, CI};
       BFIPtr = std::make_unique<BlockFrequencyInfo>(F, BPI, LI);
----------------
aengelke wrote:

Yeah. I already [started working on that](https://github.com/llvm/llvm-project/commit/f7c5e1a194c672ff91d94823f3395d075e83dcd6), but there are two problems that need to be sorted out:

- stage2 build crashes; BFI seems to make some assumptions that no longer hold after simple porting that need to be looked into.
- Adds a couple of extra machine cycle analyses to codegen pipelines; which might or might not regress perf (hard to evaluate without passing stage2 build...). Probably fixable by preserving MachineCycleAnalysis in a few more places (eg MachineLICM) and porting some more passes from MachineLoopInfo to MachineCycleInfo.

https://github.com/llvm/llvm-project/pull/210301


More information about the llvm-commits mailing list