diff options
author | Björn Gustavsson <bjorn@erlang.org> | 2019-11-19 15:22:17 +0100 |
---|---|---|
committer | John Högberg <john@erlang.org> | 2019-11-21 12:28:51 +0100 |
commit | 1037d1fabfe2c05e7d32f2a3d74c7c8b5c578848 (patch) | |
tree | 6b65228b0c3f8ea2aecd88f8532002da82820db7 /bootstrap/lib/stdlib/ebin/c.beam | |
parent | 846444c5add9ad08340d585096c94a7b6f5b5933 (diff) | |
download | erlang-1037d1fabfe2c05e7d32f2a3d74c7c8b5c578848.tar.gz |
beam_jump: Optimize away unnecessary {move,nil,{x,0}}
The improved type inference optimizations will replace
a test for an empty list at the end of function with a move
of an empty list to {x,0}. Here is an example that shows
the BEAM code before the improved type inference:
{test,is_nonempty_list,{f,3},[{x,0}]}.
.
.
.
return.
{label,3}.
{test,is_nil,{f,1},[{x,0}]}.
return.
With the improved type inference the `is_nil`
test has been replaced by a `move` instruction:
{test,is_nonempty_list,{f,3},[{x,0}]}.
.
.
.
return.
{label,3}.
{move,nil,{x,0}}.
return.
This commit introduces a simple optimization that eliminates
the `move` instruction:
{test,is_nonempty_list,{f,3},[{x,0}]}.
.
.
.
return.
{label,3}.
return.
Out of the more than 1000 modules compiled by the `scripts/diffable`
script, this optimization will bite in 578 functions spread among 200
modules.
Diffstat (limited to 'bootstrap/lib/stdlib/ebin/c.beam')
0 files changed, 0 insertions, 0 deletions