[llvm] [LoopPeel] Fix BFI when peeling last iteration without guard (PR #168250)
Joel E. Denny via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 17 10:06:56 PST 2025
================
@@ -1183,8 +1183,33 @@ bool llvm::peelLoop(Loop *L, unsigned PeelCount, bool PeelLast, LoopInfo *LI,
// If the original loop may only execute a single iteration we need to
// insert a trip count check and skip the original loop with the last
- // iteration peeled off if necessary.
- if (!SE->isKnownNonZero(BTC)) {
+ // iteration peeled off if necessary. Either way, we must update branch
+ // weights to maintain the loop body frequency.
+ if (SE->isKnownNonZero(BTC)) {
----------------
jdenny-ornl wrote:
AFK today. But that is already included.
https://github.com/llvm/llvm-project/pull/168250
More information about the llvm-commits
mailing list