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

Alexis Engelke via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 21 03:16:12 PDT 2026


aengelke wrote:

> Is narrowing the enter-block set intended?

Interesting point, I indeed failed to notice that. There's another inconsistency: isLoopEnteringEdge only returns true for truly entering edges, while getEnterBlocks (for natural loops) did not.

The code in question was introduced in https://reviews.llvm.org/D79485. Among the long discussions, I don't think that this specific code part was mentioned. It looks more like an oversight to me: in this example, there is no relevant information on the weight of bb7, so I don't think it should be enqueued. I also think that the practical impact is low.

At the end of the day, we're in the land of little-educated guessing here anyway. I don't think there's been a study on how well our BPI guesses match with actual profiling data.

> Note the SCC half moved in the other direction at the same time -- it used to push the entered block and now pushes the predecessor.

This was what [#210580](https://github.com/llvm/llvm-project/pull/210580/changes#diff-4d73631ad146f3066cb9325d73ac9dedbfd9a32a8d6dc65d4716226cc10de6beL394) was proposing to address -- I think this is simply a bug of the current implementation that this PR fixes as well.

> Could the description mention that reducible CFGs can change as well? 

Will change.

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


More information about the llvm-commits mailing list