https://github.com/JuliaLang/julia
Revision 1829ceea4cf2a0c34b34d5144fb8741bfc0445a3 authored by Keno Fischer on 05 September 2023, 05:43:00 UTC, committed by GitHub on 05 September 2023, 05:43:00 UTC
If we can determine that a function is sufficiently pure and returns a
constant, we have special ABI that lets us throw away the code for it
and just return the constant. However, we were still going through all
the steps of actually computing the code, including running the
optimizer on it, compressing it in preparation for caching, etc. We can
just stop doing that and bypass the optimizer entirely.

The actual change to do this is pretty tiny, but there's some unexpected
fallout which this needs to cleanup:
1. Various tests expect code_* queries of things inferred to ConstABI to
still return reasonable code. Fix this by manually emitting a ReturnNode
at the end of inference if the caller is a reflection function.
2. This kinda wreaks havoc on the EscapeAnalysis tests, which work by
using a side-effect of the optimizer, but a lot of the functions are
ConstABI eligible, so the optimizer doesn't run any more. Fortunately,
I'm in the middle of looking at overhauling EscapeAnalysis, so I'll have
some chance to figure out how to change the test system to actually do
this properly, rather than exfiltrating side effects. That said, since
EscapeAnalysis is not in the default pipeline, I don't think we should
hold the perf improvement until that is done.

Benchmarked to be about 10% faster locally, but we'll see what
nanosoldier thinks.

---------

Co-authored-by: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com>
1 parent 8e14322
History
Tip revision: 1829ceea4cf2a0c34b34d5144fb8741bfc0445a3 authored by Keno Fischer on 05 September 2023, 05:43:00 UTC
optimizer: Do not run if we know the function is ConstABI eligible (#51143)
Tip revision: 1829cee
File Mode Size
.devcontainer
.github
base
cli
contrib
deps
doc
etc
src
stdlib
test
.buildkite-external-version -rw-r--r-- 5 bytes
.clang-format -rw-r--r-- 3.3 KB
.clangd -rw-r--r-- 114 bytes
.codecov.yml -rw-r--r-- 52 bytes
.git-blame-ignore-revs -rw-r--r-- 371 bytes
.gitattributes -rw-r--r-- 65 bytes
.gitignore -rw-r--r-- 523 bytes
.mailmap -rw-r--r-- 12.7 KB
CITATION.bib -rw-r--r-- 513 bytes
CITATION.cff -rw-r--r-- 940 bytes
CONTRIBUTING.md -rw-r--r-- 23.4 KB
HISTORY.md -rw-r--r-- 372.5 KB
LICENSE.md -rw-r--r-- 1.3 KB
Make.inc -rw-r--r-- 55.7 KB
Makefile -rw-r--r-- 30.5 KB
NEWS.md -rw-r--r-- 2.1 KB
README.md -rw-r--r-- 7.3 KB
THIRDPARTY.md -rw-r--r-- 3.8 KB
VERSION -rw-r--r-- 11 bytes
julia.spdx.json -rw-r--r-- 35.8 KB
pkgimage.mk -rw-r--r-- 6.3 KB
sysimage.mk -rw-r--r-- 4.3 KB

README.md

back to top