aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/compile.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-10-31 19:45:22 +0100
committerBjörn Gustavsson <[email protected]>2018-11-28 11:36:33 +0100
commit555b633acadc39b4b38d920fd678d7a2cc7407e6 (patch)
tree9e94a6d7232f6c3e233d66a085dbac46ca5ebf4b /lib/compiler/src/compile.erl
parent5d698dd744cde1b9bad612726f491cc8ff6b129e (diff)
downloadotp-555b633acadc39b4b38d920fd678d7a2cc7407e6.tar.gz
otp-555b633acadc39b4b38d920fd678d7a2cc7407e6.tar.bz2
otp-555b633acadc39b4b38d920fd678d7a2cc7407e6.zip
Share the code for semantically equivalent blocks
Share code for semantically equivalent blocks referred to to by `br` and `switch` instructions. A similar optimization is done in `beam_jump`, but doing it here as well is beneficial as it may enable other optimizations. Also, if there are many semantically equivalent clauses, this optimization can substanstially decrease compilation times.
Diffstat (limited to 'lib/compiler/src/compile.erl')
-rw-r--r--lib/compiler/src/compile.erl4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl
index 65c4f140c9..14c8c5b4ab 100644
--- a/lib/compiler/src/compile.erl
+++ b/lib/compiler/src/compile.erl
@@ -823,6 +823,9 @@ kernel_passes() ->
{pass,beam_kernel_to_ssa},
{iff,dssa,{listing,"ssa"}},
{iff,ssalint,{pass,beam_ssa_lint}},
+ {unless,no_share_opt,{pass,beam_ssa_share}},
+ {iff,dssashare,{listing,"ssashare"}},
+ {iff,ssalint,{pass,beam_ssa_lint}},
{unless,no_bsm_opt,{pass,beam_ssa_bsm}},
{iff,dssabsm,{listing,"ssabsm"}},
{iff,ssalint,{pass,beam_ssa_lint}},
@@ -2098,6 +2101,7 @@ pre_load() ->
beam_ssa_opt,
beam_ssa_pre_codegen,
beam_ssa_recv,
+ beam_ssa_share,
beam_ssa_type,
beam_trim,
beam_utils,