aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2019-02-21 06:06:08 +0100
committerBjörn Gustavsson <[email protected]>2019-02-21 14:04:29 +0100
commit54df0e73b3c3d0240eedc5b1469aa89ecb8de531 (patch)
tree53618ae643380b02e008f02d1dd02ee3ec6e16bf
parent388fe9d0ef5d2ccae6a9c07da2d36ac568dd250f (diff)
downloadotp-54df0e73b3c3d0240eedc5b1469aa89ecb8de531.tar.gz
otp-54df0e73b3c3d0240eedc5b1469aa89ecb8de531.tar.bz2
otp-54df0e73b3c3d0240eedc5b1469aa89ecb8de531.zip
beam_ssa_opt: Do local CSE of get_tuple_element instructions
For some reason, a `get_tuple_element` instruction was not deemed suitble for local common sub expression elimination. It turns out that enabling CSE for `get_tuple_element` is benefical. It will also be even more benefical in a future commit where some of the optimizations in `sys_core_fold` are removed.
-rw-r--r--lib/compiler/src/beam_ssa_opt.erl1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_ssa_opt.erl b/lib/compiler/src/beam_ssa_opt.erl
index f8e19d0aa7..6e548dd529 100644
--- a/lib/compiler/src/beam_ssa_opt.erl
+++ b/lib/compiler/src/beam_ssa_opt.erl
@@ -849,6 +849,7 @@ cse_expr(#b_set{op=Op,args=Args}=I) ->
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=get_tuple_element}) -> 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