[llvm] [LoopUnroll] Use branch probability in multi-exit loop unrolling (PR #164799)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 23 12:06:16 PDT 2025


arpilipe wrote:

AFAIU, the issue is that loop-unroll doesn't preserve BPI. It is invalidated by the pass manager once loop-unroll is done, so this is all fair and square. 

The problem arises if you try to use it within the pass. Transforms invalidate the analysis, resulting in stale BPI. The fix would be to teach loop-unroll to update BPI as it modifies the IR.

What Marek has here is a reasonable workaround, and we have precedents for this (e.g. LoopPredication::isLoopProfitableToPredicate) 

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


More information about the llvm-commits mailing list