aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_ssa_opt.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-09-09 07:42:53 +0200
committerBjörn Gustavsson <[email protected]>2018-09-12 14:19:06 +0200
commitf25448763f55d595e00fe570f2108f669f3f6b1a (patch)
tree415764c31a50cdfa060c820241c219cceb72c042 /lib/compiler/src/beam_ssa_opt.erl
parentb241241f21bee111c9aac7185cb8fd9a751557bd (diff)
downloadotp-f25448763f55d595e00fe570f2108f669f3f6b1a.tar.gz
otp-f25448763f55d595e00fe570f2108f669f3f6b1a.tar.bz2
otp-f25448763f55d595e00fe570f2108f669f3f6b1a.zip
beam_ssa_opt: Don't do CSE for tuple_size/1
Not doing CSE for tuple_size/1 seems to generate slightly better code in most cases.
Diffstat (limited to 'lib/compiler/src/beam_ssa_opt.erl')
-rw-r--r--lib/compiler/src/beam_ssa_opt.erl7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_ssa_opt.erl b/lib/compiler/src/beam_ssa_opt.erl
index 9289b76f28..7fbc090132 100644
--- a/lib/compiler/src/beam_ssa_opt.erl
+++ b/lib/compiler/src/beam_ssa_opt.erl
@@ -486,6 +486,13 @@ cse_suitable(#b_set{op=get_hd}) -> true;
cse_suitable(#b_set{op=get_tl}) -> true;
cse_suitable(#b_set{op=put_list}) -> true;
cse_suitable(#b_set{op=put_tuple}) -> true;
+cse_suitable(#b_set{op={bif,tuple_size}}) ->
+ %% Doing CSE for tuple_size/1 can prevent the
+ %% creation of test_arity and select_tuple_arity
+ %% instructions. That could decrease performance
+ %% and beam_validator could fail to understand
+ %% that tuple operations that follow are safe.
+ false;
cse_suitable(#b_set{op={bif,Name},args=Args}) ->
%% Doing CSE for comparison operators would prevent
%% creation of 'test' instructions.