Commit a72de8b
Disable pathologically expensive
`SimplifySelectOps` is a late optimization in LLVM that attempts to
translate `select(C, load(A), load(B))` into `load(select(C, A, B))`.
However, in order for it to do this optimization, it needs to check that
`C` does not depend on the result of `load(A)` or `load(B)`.
Unfortunately (unlikely Julia and LLVM at the IR level), LLVM does not
have a topological order of statements computed at this stage of the
compiler, so LLVM needs to iterate through all statements in the
function in order to perform this legality check. For large functions,
this is extremely expensive, accounting for the majority of all
compilation time for such functions. On the other hand, the optimization
itself is minor, allowing at most the elision of one additional load
(and doesn't fire particularly often, because the middle end can perform
similar optimizations). Until there is a proper solution in LLVM, simply
disable this optimizations, making LLVM several orders of magnitude
faster on real world benchmarks.
X-ref: llvm#60132
(cherry picked from commit 8a2c8f5)
(cherry picked from commit d7563d0)
(cherry picked from commit 6968daa)SimplifySelectOps optimization1 parent 4ec94dd commit a72de8b
1 file changed
+1
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27870 | 27870 | | |
27871 | 27871 | | |
27872 | 27872 | | |
| 27873 | + | |
27873 | 27874 | | |
27874 | 27875 | | |
27875 | 27876 | | |
| |||
0 commit comments