Revision c22889e76cb9b7fd8a4710d9bf53e827aaa907e4 authored by Shuhei Kadowaki on 24 August 2021, 04:21:29 UTC, committed by Shuhei Kadowaki on 26 October 2021, 14:45:33 UTC
Currently our constant-prop' heuristics work in the following way:
1. `const_prop_entry_heuristic`
2. `const_prop_argument_heuristic` & `const_prop_rettype_heuristic`
3. `force_const_prop` custom heuristic & `!const_prop_function_heuristic`
4. `MethodInstance` specialization and `const_prop_methodinstance_heuristic`

This PR changes it so that the step 1. now works like:

1. `force_const_prop` custom heuristic & `const_prop_entry_heuristic`

and the steps 2., 3. and 4. don't change

This change particularly allows us to more forcibly constant-propagate
for `getproperty` and `setproperty!`, and inline them more, e.g.:
```julia
mutable struct Foo
    val
    _::Int
end

function setter(xs)
    for x in xs
        x.val = nothing # `setproperty!` can be inlined with this PR
    end
end
```

It might be useful because now we can intervene into the constant-prop'
heuristic in a more reliable way with the `aggressive_constprop` interface.

I did the simple benchmark below, and it looks like this change doesn't
cause the latency problem for this particular example:
```zsh
~/julia master aviatesk@amdci2 6s
❯ ./usr/bin/julia -e '@time using Plots; @time plot(rand(10,3))'
  3.708500 seconds (7.28 M allocations: 506.128 MiB, 3.45% gc time, 1.13% compilation time)
  2.817794 seconds (3.45 M allocations: 195.127 MiB, 7.84% gc time, 53.76% compilation time)

~/julia avi/forceconstantprop aviatesk@amdci2 6s
❯ ./usr/bin/julia -e '@time using Plots; @time plot(rand(10,3))'
  3.622109 seconds (7.02 M allocations: 481.710 MiB, 4.19% gc time, 1.17% compilation time)
  2.863419 seconds (3.44 M allocations: 194.210 MiB, 8.02% gc time, 53.53% compilation time)
```
1 parent da71d29
History
File Mode Size
clangsa
flisp
jsvm-emscripten
support
.gitignore -rw-r--r-- 346 bytes
APInt-C.cpp -rw-r--r-- 15.2 KB
APInt-C.h -rw-r--r-- 5.1 KB
Makefile -rw-r--r-- 19.1 KB
abi_aarch64.cpp -rw-r--r-- 15.1 KB
abi_arm.cpp -rw-r--r-- 8.9 KB
abi_llvm.cpp -rw-r--r-- 2.4 KB
abi_ppc64le.cpp -rw-r--r-- 5.7 KB
abi_win32.cpp -rw-r--r-- 2.9 KB
abi_win64.cpp -rw-r--r-- 2.9 KB
abi_x86.cpp -rw-r--r-- 3.3 KB
abi_x86_64.cpp -rw-r--r-- 8.3 KB
anticodegen.c -rw-r--r-- 2.8 KB
aotcompile.cpp -rw-r--r-- 40.5 KB
array.c -rw-r--r-- 45.0 KB
ast.c -rw-r--r-- 49.9 KB
ast.scm -rw-r--r-- 20.8 KB
atomics.h -rw-r--r-- 6.7 KB
bin2hex.scm -rw-r--r-- 388 bytes
builtin_proto.h -rw-r--r-- 1.5 KB
builtins.c -rw-r--r-- 68.7 KB
ccall.cpp -rw-r--r-- 80.9 KB
ccalltest.c -rw-r--r-- 24.7 KB
cgmemmgr.cpp -rw-r--r-- 29.7 KB
cgutils.cpp -rw-r--r-- 150.6 KB
codegen.cpp -rw-r--r-- 354.3 KB
codegen_shared.h -rw-r--r-- 1.9 KB
common_symbols1.inc -rw-r--r-- 2.1 KB
common_symbols2.inc -rw-r--r-- 5.6 KB
crc32c-tables.c -rw-r--r-- 43.4 KB
crc32c.c -rw-r--r-- 19.8 KB
datatype.c -rw-r--r-- 64.9 KB
debuginfo.cpp -rw-r--r-- 61.2 KB
debuginfo.h -rw-r--r-- 682 bytes
disasm.cpp -rw-r--r-- 37.6 KB
dlload.c -rw-r--r-- 12.4 KB
dump.c -rw-r--r-- 108.3 KB
features_aarch32.h -rw-r--r-- 1.1 KB
features_aarch64.h -rw-r--r-- 4.6 KB
features_x86.h -rw-r--r-- 3.9 KB
file_constants.h -rw-r--r-- 708 bytes
gc-debug.c -rw-r--r-- 46.9 KB
gc-pages.c -rw-r--r-- 13.1 KB
gc-stacks.c -rw-r--r-- 7.7 KB
gc.c -rw-r--r-- 140.1 KB
gc.h -rw-r--r-- 22.4 KB
gen_sysimg_symtab.jl -rw-r--r-- 2.0 KB
getopt.c -rw-r--r-- 4.3 KB
getopt.h -rw-r--r-- 1.8 KB
gf.c -rw-r--r-- 131.1 KB
iddict.c -rw-r--r-- 5.7 KB
init.c -rw-r--r-- 29.5 KB
interpreter.c -rw-r--r-- 29.9 KB
intrinsics.cpp -rw-r--r-- 69.0 KB
intrinsics.h -rw-r--r-- 3.1 KB
ircode.c -rw-r--r-- 31.8 KB
jitlayers.cpp -rw-r--r-- 42.8 KB
jitlayers.h -rw-r--r-- 8.5 KB
jl_exported_data.inc -rw-r--r-- 3.6 KB
jl_exported_funcs.inc -rw-r--r-- 15.0 KB
jl_uv.c -rw-r--r-- 27.9 KB
jlapi.c -rw-r--r-- 19.4 KB
jlfrontend.scm -rw-r--r-- 9.4 KB
jloptions.c -rw-r--r-- 30.2 KB
jloptions.h -rw-r--r-- 1.4 KB
jltypes.c -rw-r--r-- 100.2 KB
julia-parser.scm -rw-r--r-- 109.4 KB
julia-syntax.scm -rw-r--r-- 221.8 KB
julia.expmap -rw-r--r-- 846 bytes
julia.h -rw-r--r-- 91.6 KB
julia_assert.h -rw-r--r-- 988 bytes
julia_fasttls.h -rw-r--r-- 1.6 KB
julia_gcext.h -rw-r--r-- 6.6 KB
julia_internal.h -rw-r--r-- 59.4 KB
julia_threads.h -rw-r--r-- 12.3 KB
llvm-alloc-opt.cpp -rw-r--r-- 56.2 KB
llvm-demote-float16.cpp -rw-r--r-- 5.1 KB
llvm-final-gc-lowering.cpp -rw-r--r-- 11.5 KB
llvm-gc-invariant-verifier.cpp -rw-r--r-- 7.2 KB
llvm-julia-licm.cpp -rw-r--r-- 5.0 KB
llvm-late-gc-lowering.cpp -rw-r--r-- 114.0 KB
llvm-lower-handlers.cpp -rw-r--r-- 8.6 KB
llvm-muladd.cpp -rw-r--r-- 3.0 KB
llvm-multiversioning.cpp -rw-r--r-- 38.5 KB
llvm-pass-helpers.cpp -rw-r--r-- 9.5 KB
llvm-pass-helpers.h -rw-r--r-- 5.4 KB
llvm-propagate-addrspaces.cpp -rw-r--r-- 11.6 KB
llvm-ptls.cpp -rw-r--r-- 12.4 KB
llvm-remove-addrspaces.cpp -rw-r--r-- 15.7 KB
llvm-remove-ni.cpp -rw-r--r-- 1.2 KB
llvm-simdloop.cpp -rw-r--r-- 8.7 KB
llvm-version.h -rw-r--r-- 891 bytes
llvmcalltest.cpp -rw-r--r-- 1.9 KB
locks.h -rw-r--r-- 4.2 KB
macroexpand.scm -rw-r--r-- 25.9 KB
match.scm -rw-r--r-- 9.8 KB
method.c -rw-r--r-- 36.9 KB
mk_julia_flisp_boot.scm -rw-r--r-- 137 bytes
module.c -rw-r--r-- 29.1 KB
opaque_closure.c -rw-r--r-- 3.2 KB
options.h -rw-r--r-- 5.6 KB
partr.c -rw-r--r-- 17.8 KB
precompile.c -rw-r--r-- 14.6 KB
processor.cpp -rw-r--r-- 26.8 KB
processor.h -rw-r--r-- 9.7 KB
processor_arm.cpp -rw-r--r-- 65.0 KB
processor_fallback.cpp -rw-r--r-- 4.6 KB
processor_x86.cpp -rw-r--r-- 39.3 KB
rtutils.c -rw-r--r-- 46.2 KB
runtime_ccall.cpp -rw-r--r-- 10.7 KB
runtime_intrinsics.c -rw-r--r-- 40.3 KB
safepoint.c -rw-r--r-- 6.9 KB
serialize.h -rw-r--r-- 3.1 KB
signal-handling.c -rw-r--r-- 10.5 KB
signals-mach.c -rw-r--r-- 22.8 KB
signals-unix.c -rw-r--r-- 29.0 KB
signals-win.c -rw-r--r-- 17.0 KB
simplevector.c -rw-r--r-- 2.9 KB
smallintset.c -rw-r--r-- 5.5 KB
stackwalk.c -rw-r--r-- 28.3 KB
staticdata.c -rw-r--r-- 69.7 KB
subtype.c -rw-r--r-- 141.8 KB
symbol.c -rw-r--r-- 5.0 KB
sys.c -rw-r--r-- 22.4 KB
task.c -rw-r--r-- 42.8 KB
threading.c -rw-r--r-- 16.3 KB
threading.h -rw-r--r-- 684 bytes
timing.c -rw-r--r-- 1.8 KB
timing.h -rw-r--r-- 4.3 KB
toplevel.c -rw-r--r-- 38.6 KB
typemap.c -rw-r--r-- 52.7 KB
utils.scm -rw-r--r-- 3.0 KB
uv_constants.h -rw-r--r-- 783 bytes

back to top