diff options
author | Björn Gustavsson <[email protected]> | 2018-11-14 06:48:54 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2018-11-15 14:07:49 +0100 |
commit | 693cda7f01137eda93362a74abd6028c41d2f5c6 (patch) | |
tree | 317cf32649093968fa2b2c335b40427d43b798cc /otp_versions.table | |
parent | f7f40ec6b1703008b404f67ca5ef78522a77c718 (diff) | |
download | otp-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 'otp_versions.table')
0 files changed, 0 insertions, 0 deletions