Commit edeaf41
authored
[ConstantHoisting] Cache OptForSize. (#79170)
CacheOptForSize to remove quadratic behavior.
For each constant analyzed, ConstantHoising calls
`shouldOptimizeForSize(F)`, which calls `PSI.getTotalCallCount(F)`.
PSI.getTotalCallCount(F) goes through all the instructions in all basic
blocks, and checks if each is a call, to count them up.
This reduces `llc` time for a very large IR from ~10min to under 3min.
Reproducer testcase is much too large to share.1 parent 3428c28 commit edeaf41
File tree
2 files changed
+5
-3
lines changed- llvm
- include/llvm/Transforms/Scalar
- lib/Transforms/Scalar
2 files changed
+5
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| 156 | + | |
156 | 157 | | |
157 | 158 | | |
158 | 159 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
576 | 576 | | |
577 | 577 | | |
578 | 578 | | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | 579 | | |
583 | 580 | | |
584 | 581 | | |
| |||
948 | 945 | | |
949 | 946 | | |
950 | 947 | | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
951 | 952 | | |
952 | 953 | | |
953 | 954 | | |
| |||
0 commit comments