diff options
author | John Högberg <[email protected]> | 2018-09-20 10:30:40 +0200 |
---|---|---|
committer | John Högberg <[email protected]> | 2018-09-20 14:02:36 +0200 |
commit | 367f4a3fabb12cda3f2547e9908acbf28cb34e3a (patch) | |
tree | 94c9a81dcbef75a66a2f326d970466a9890a620d | |
parent | 81d34181d391709e9d2c404fa730ee9b5c72b5e3 (diff) | |
download | otp-367f4a3fabb12cda3f2547e9908acbf28cb34e3a.tar.gz otp-367f4a3fabb12cda3f2547e9908acbf28cb34e3a.tar.bz2 otp-367f4a3fabb12cda3f2547e9908acbf28cb34e3a.zip |
beam_ssa_recv: Remove redundant {var, _} wrapping
Now that variables are represented as #b_var{}, there's no longer
any risk of colliding with anything else.
-rw-r--r-- | lib/compiler/src/beam_ssa_recv.erl | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/compiler/src/beam_ssa_recv.erl b/lib/compiler/src/beam_ssa_recv.erl index f6877384d9..6e49b128da 100644 --- a/lib/compiler/src/beam_ssa_recv.erl +++ b/lib/compiler/src/beam_ssa_recv.erl @@ -166,7 +166,7 @@ ref_in_tuple(Tuple, Blocks) -> beam_ssa:fold_instrs_rpo(F, [0], no, Blocks). opt_ref_used(RecvLbl, Ref, Blocks) -> - Vs = #{{var,Ref}=>ref,ref=>Ref,ref_matched=>false}, + Vs = #{Ref=>ref,ref=>Ref,ref_matched=>false}, case opt_ref_used_1(RecvLbl, Vs, Blocks) of used -> true; not_used -> false; @@ -183,7 +183,7 @@ opt_ref_used_1(L, Vs0, Blocks) -> end. opt_ref_used_is([#b_set{op=peek_message,dst=Msg}|Is], Vs0) -> - Vs = Vs0#{{var,Msg}=>message}, + Vs = Vs0#{Msg=>message}, opt_ref_used_is(Is, Vs); opt_ref_used_is([#b_set{op={bif,Bif},args=Args,dst=Dst}=I|Is], Vs0) -> @@ -254,15 +254,14 @@ ref_used_in([], _) -> done. update_vars(#b_set{args=Args,dst=Dst}, Vs) -> Vars = [V || #b_var{}=V <- Args], - All = all(fun(V) -> - Var = {var,V}, + All = all(fun(Var) -> case Vs of #{Var:=message} -> true; #{} -> false end end, Vars), case All of - true -> Vs#{{var,Dst}=>message}; + true -> Vs#{Dst=>message}; false -> Vs end. @@ -270,9 +269,7 @@ update_vars(#b_set{args=Args,dst=Dst}, Vs) -> %% Return 'true' if Args denotes a comparison between the %% reference and message or part of the message. -is_ref_msg_comparison([#b_var{}=A1,#b_var{}=A2], Vs) -> - V1 = {var,A1}, - V2 = {var,A2}, +is_ref_msg_comparison([#b_var{}=V1,#b_var{}=V2], Vs) -> case Vs of #{V1:=ref,V2:=message} -> true; #{V1:=message,V2:=ref} -> true; |