aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_ssa_opt.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-09-09 06:30:23 +0200
committerBjörn Gustavsson <[email protected]>2018-09-12 14:19:06 +0200
commitb241241f21bee111c9aac7185cb8fd9a751557bd (patch)
treeb517bc4ba8caf23c71f6a8ec4deed22986ea95e9 /lib/compiler/src/beam_ssa_opt.erl
parentb3b195fd104e7052fe31becbab43fccb652f2d0a (diff)
downloadotp-b241241f21bee111c9aac7185cb8fd9a751557bd.tar.gz
otp-b241241f21bee111c9aac7185cb8fd9a751557bd.tar.bz2
otp-b241241f21bee111c9aac7185cb8fd9a751557bd.zip
beam_ssa_opt: Slightly optimize compile-time performance of CSE
Diffstat (limited to 'lib/compiler/src/beam_ssa_opt.erl')
-rw-r--r--lib/compiler/src/beam_ssa_opt.erl6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_ssa_opt.erl b/lib/compiler/src/beam_ssa_opt.erl
index 6d94c38685..9289b76f28 100644
--- a/lib/compiler/src/beam_ssa_opt.erl
+++ b/lib/compiler/src/beam_ssa_opt.erl
@@ -417,7 +417,13 @@ cse_successors(_Is, Blk, Es, M) ->
cse_successors_1([L|Ls], Es0, M) ->
case M of
+ #{L:=Es1} when map_size(Es1) =:= 0 ->
+ %% The map is already empty. No need to do anything
+ %% since the intersection will be empty.
+ cse_successors_1(Ls, Es0, M);
#{L:=Es1} ->
+ %% Calculate the intersection of the two maps.
+ %% Both keys and values must match.
Es = maps:filter(fun(Key, Value) ->
case Es1 of
#{Key:=Value} -> true;