[all-commits] [llvm/llvm-project] f779ec: [BPI] Cache LoopExitBlocks to improve compile time...
Enna1 via All-commits
all-commits at lists.llvm.org
Sun Jun 2 19:21:29 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f779ec7c13bdfccd29655d13a325f34c60797a76
https://github.com/llvm/llvm-project/commit/f779ec7c13bdfccd29655d13a325f34c60797a76
Author: Enna1 <xumingjie.enna1 at bytedance.com>
Date: 2024-06-03 (Mon, 03 Jun 2024)
Changed paths:
M llvm/lib/Analysis/BranchProbabilityInfo.cpp
Log Message:
-----------
[BPI] Cache LoopExitBlocks to improve compile time (#93451)
The `LoopBlock` stored in `LoopWorkList` consist of basic block and its
loop data information. When iterate `LoopWorkList`, if estimated weight
of a loop is not stored in `EstimatedLoopWeight`, `getLoopExitBlocks()`
is called to get all exit blocks of the loop. The estimated weight of a
loop is calculated by iterating over edges leading from basic block to
all exit blocks of the loop. If at least one edge has unknown estimated
weight, the estimated weight of loop is unknown and will not be stored
in `EstimatedLoopWeight`. `LoopWorkList` can contain different blocks in
a same loop, so there is wasted work that calls `getLoopExitBlocks()`
for same loop multiple times.
Since computing the exit blocks of loop is expensive and the loop
structure is not mutated in Branch Probability Analysis, we can cache
the result and improve compile time.
With this change, the overall compile time for a file containing a very
large loop is dropped by around 82%.
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