[all-commits] [llvm/llvm-project] b8a72d: [LoopUnroll][NFC] Record conditional latch info
Joel E. Denny via All-commits
all-commits at lists.llvm.org
Thu Feb 19 15:38:57 PST 2026
Branch: refs/heads/users/jdenny-ornl/fix-blockfreq-unroll-unconditional-latches
Home: https://github.com/llvm/llvm-project
Commit: b8a72d4e74303f3caffd9aa23321cf405423b0b6
https://github.com/llvm/llvm-project/commit/b8a72d4e74303f3caffd9aa23321cf405423b0b6
Author: Joel E. Denny <jdenny.ornl at gmail.com>
Date: 2026-02-19 (Thu, 19 Feb 2026)
Changed paths:
M llvm/include/llvm/Support/BranchProbability.h
M llvm/lib/Transforms/Utils/LoopUnroll.cpp
M llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
Log Message:
-----------
[LoopUnroll][NFC] Record conditional latch info
This patch gathers conditional latch info needed for PR #179520, which
fixes block frequencies when LoopUnroll converts a conditional latch
in an unrolled loop iteration to unconditional. Without PR #179520,
this patch is useless and should not land.
Commit: de085a05ec47c5a30685581c6600280b539851a3
https://github.com/llvm/llvm-project/commit/de085a05ec47c5a30685581c6600280b539851a3
Author: Joel E. Denny <jdenny.ornl at gmail.com>
Date: 2026-02-19 (Thu, 19 Feb 2026)
Changed paths:
M llvm/lib/Transforms/Utils/LoopUnroll.cpp
Log Message:
-----------
Merge branch 'fix-blockfreq-unroll-unconditional-latches--prep' into fix-blockfreq-unroll-unconditional-latches
Commit: 4a07c970cc1b17eedef96b12949c919135ecfc1c
https://github.com/llvm/llvm-project/commit/4a07c970cc1b17eedef96b12949c919135ecfc1c
Author: Joel E. Denny <jdenny.ornl at gmail.com>
Date: 2026-02-19 (Thu, 19 Feb 2026)
Changed paths:
M llvm/lib/Transforms/Utils/LoopUnroll.cpp
M llvm/test/Transforms/LoopUnroll/branch-weights-freq/unroll-complete.ll
M llvm/test/Transforms/LoopUnroll/branch-weights-freq/unroll-epilog.ll
M llvm/test/Transforms/LoopUnroll/branch-weights-freq/unroll-partial-unconditional-latch.ll
Log Message:
-----------
Extract many changes into descendant PRs
New commit log:
[LoopUnroll] Fix freqs for unconditional latches: N<=2
As another step in issue #135812, this patch fixes block frequencies
when LoopUnroll converts a conditional latch in an unrolled loop
iteration to unconditional. It thus includes complete loop unrolling
(the conditional backedge becomes an unconditional loop exit), which
might be applied to the original loop or to its remainder loop.
As explained in detail in the header comments on the
fixProbContradiction function that this patch introduces, these
conversions mean LoopUnroll has proven that the original uniform latch
probability is incorrect for the original loop iterations associated
with the converted latches. However, LoopUnroll often is able to
perform these corrections for only some iterations, leaving other
iterations with the original latch probability, and thus corrupting
the aggregate effect on the total frequency of the original loop body.
This patch ensures that the total frequency of the original loop body,
summed across all its occurrences in the unrolled loop after the
aforementioned conversions, is the same as in the original loop.
Unlike other patches in this series, this patch cannot derive the
required latch probabilities directly from the original uniform latch
probability because it has been proven incorrect for some original
loop iterations. Instead, this patch computes entirely new
probabilities for the remaining N conditional latches in the unrolled
loop.
This patch only handles N <= 2, for which it uses simple formulas to
compute a single uniform probability across the latches. Future
patches will handle N > 2.
This patch series does not consider the presence of non-latch loop
exits, and I do not have a solid plan for that case. See fixme
comments this patch introduces.
Compare: https://github.com/llvm/llvm-project/compare/52c85558f61b...4a07c970cc1b
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