[all-commits] [llvm/llvm-project] 21fedc: [LoopPeel] Fix BFI when peeling last iteration wit...

Joel E. Denny via All-commits all-commits at lists.llvm.org
Thu Nov 20 07:46:14 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 21fedcbf89a27521c1c4822c51232605e2c3a33f
      https://github.com/llvm/llvm-project/commit/21fedcbf89a27521c1c4822c51232605e2c3a33f
  Author: Joel E. Denny <jdenny.ornl at gmail.com>
  Date:   2025-11-20 (Thu, 20 Nov 2025)

  Changed paths:
    M llvm/include/llvm/Support/BranchProbability.h
    M llvm/lib/Support/BranchProbability.cpp
    M llvm/lib/Transforms/Utils/LoopPeel.cpp
    M llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
    A llvm/test/Transforms/LoopUnroll/branch-weights-freq/peel-last-iteration-no-guard.ll

  Log Message:
  -----------
  [LoopPeel] Fix BFI when peeling last iteration without guard (#168250)

LoopPeel sometimes proves that, when reached, the original loop always
executes at least two iterations. LoopPeel then unconditionally executes
both the remaining loop's initial iteration and the peeled final
iteration. But that increases the latter's frequency above its frequency
in the original loop. To maintain the total frequency, this patch
compensates by decreasing the remaininng loop's latch probability.

This is another step in issue #135812 and was discussed at
<https://github.com/llvm/llvm-project/pull/166858#discussion_r2528968542>.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list