aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineFunction.cpp
diff options
context:
space:
mode:
authorJoel E. Denny <jdenny.ornl@gmail.com>2025-10-02 12:07:55 -0400
committerGitHub <noreply@github.com>2025-10-02 16:07:55 +0000
commitafb262855e755b499a733c2b84b6a1cb789b3b1f (patch)
treeaaecb75ce28035e4de81bcf31fe55e1f0b3201dd /llvm/lib/CodeGen/MachineFunction.cpp
parent5bbf72400cfeb8f4e205e9ff1c98d34d2997796c (diff)
downloadllvm-afb262855e755b499a733c2b84b6a1cb789b3b1f.zip
llvm-afb262855e755b499a733c2b84b6a1cb789b3b1f.tar.gz
llvm-afb262855e755b499a733c2b84b6a1cb789b3b1f.tar.bz2
[LoopPeel] Fix branch weights' effect on block frequencies (#128785)
[LoopPeel] Fix branch weights' effect on block frequencies This patch implements the LoopPeel 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). In summary, a loop's latch block can have branch weight metadata that encodes an estimated trip count that is derived from application profile data. Initially, the loop body's block frequencies agree with the estimated trip count, as expected. However, sometimes loop transformations adjust those branch weights in a way that correctly maintains the estimated trip count but that corrupts the block frequencies. This patch addresses that problem in LoopPeel, which it changes 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.
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
0 files changed, 0 insertions, 0 deletions