aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.h
diff options
context:
space:
mode:
authorEnna1 <xumingjie.enna1@bytedance.com>2024-06-03 10:21:07 +0800
committerGitHub <noreply@github.com>2024-06-03 10:21:07 +0800
commitf779ec7c13bdfccd29655d13a325f34c60797a76 (patch)
tree840b1bf6ea23a69b5884e65b2a519417359d94cf /clang/lib/CodeGen/CodeGenModule.h
parentd7d2d4f53fc79b4b58e8d8d08151b577c3699d4a (diff)
downloadllvm-f779ec7c13bdfccd29655d13a325f34c60797a76.zip
llvm-f779ec7c13bdfccd29655d13a325f34c60797a76.tar.gz
llvm-f779ec7c13bdfccd29655d13a325f34c60797a76.tar.bz2
[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%.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.h')
0 files changed, 0 insertions, 0 deletions