diff options
| author | Joel E. Denny <jdenny.ornl@gmail.com> | 2025-10-31 10:44:27 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-31 10:44:27 -0400 |
| commit | 24557cce40b7d90c289b4a537ed95eaf6522f53c (patch) | |
| tree | 6c2dd2656a25f8d7423d126b79268c0d7bf038a8 /clang/lib/Frontend/CompilerInvocation.cpp | |
| parent | e72876a519b1c65dc2cee96d512ac6967c6a1555 (diff) | |
| download | llvm-24557cce40b7d90c289b4a537ed95eaf6522f53c.zip llvm-24557cce40b7d90c289b4a537ed95eaf6522f53c.tar.gz llvm-24557cce40b7d90c289b4a537ed95eaf6522f53c.tar.bz2 | |
[LoopUnroll] Fix block frequencies when no runtime (#157754)
This patch implements the LoopUnroll changes discussed in [[RFC] Fix
Loop Transformations to Preserve Block
Frequencies](https://discourse.llvm.org/t/rfc-fix-loop-transformations-to-preserve-block-frequencies/85785)
and is thus another step in addressing issue #135812.
In summary, for the case of partial loop unrolling without a remainder
loop, this patch changes LoopUnroll to:
- Maintain branch weights consistently with the original loop for the
sake of preserving the total frequency of the original loop body.
- Store the new estimated trip count in the
`llvm.loop.estimated_trip_count` metadata, introduced by PR #148758.
- Correct the new estimated trip count (e.g., 3 instead of 2) when the
original estimated trip count (e.g., 10) divided by the unroll count
(e.g., 4) leaves a remainder (e.g., 2).
There are loop unrolling cases this patch does not fully fix, such as
partial unrolling with a remainder loop and complete unrolling, and
there are two associated tests whose branch weights this patch adversely
affects. They will be addressed in future patches that should land with
this patch.
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions
