aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_ssa_pre_codegen.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-11-14 06:48:54 +0100
committerBjörn Gustavsson <[email protected]>2018-11-15 14:07:49 +0100
commit693cda7f01137eda93362a74abd6028c41d2f5c6 (patch)
tree317cf32649093968fa2b2c335b40427d43b798cc /lib/compiler/src/beam_ssa_pre_codegen.erl
parentf7f40ec6b1703008b404f67ca5ef78522a77c718 (diff)
downloadotp-693cda7f01137eda93362a74abd6028c41d2f5c6.tar.gz
otp-693cda7f01137eda93362a74abd6028c41d2f5c6.tar.bz2
otp-693cda7f01137eda93362a74abd6028c41d2f5c6.zip
beam_ssa_type: Speed up type analysis for huge functions
The type analysis pass (`beam_ssa_type`) keeps the type information for all variables that are in scope. For huge functions, the `join_types/2` function could get really slow when joining two maps with thousands of variables in each. Use a conservative approach to discard type information for variables only used once by a `br` or `switch` in the same block as the variable is defined in. This approach reduces the runtime for the `beam_ssa_type` pass from a few minutes down to few seconds for this module: https://github.com/aggelgian/cuter/blob/master/src/cuter_binlib.erl Rejected approach: Calculate liveness information for all variables and discard type information for any variable that would not be used again. That turned out to not work because some optimizations would invalidate the liveness (in particular, substitutions could lengthen the lifetime for a variable). Trying to update the liveness information when doing the optimizations would be tricky. Noticed-by: Kostis Sagonas
Diffstat (limited to 'lib/compiler/src/beam_ssa_pre_codegen.erl')
0 files changed, 0 insertions, 0 deletions