diff options
author | Björn Gustavsson <[email protected]> | 2015-03-06 15:50:45 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2015-03-09 09:59:37 +0100 |
commit | e2ced63dfaf14f38d2a334d51b3ca45030d55e0c (patch) | |
tree | bf422e922cddeacd0786ed5f7eda4667546ba8db /lib/compiler/src/beam_dead.erl | |
parent | d922184dcb5b159b0ff9052d99990dc23b36dc17 (diff) | |
download | otp-e2ced63dfaf14f38d2a334d51b3ca45030d55e0c.tar.gz otp-e2ced63dfaf14f38d2a334d51b3ca45030d55e0c.tar.bz2 otp-e2ced63dfaf14f38d2a334d51b3ca45030d55e0c.zip |
beam_dead: Improve optimization by eliminating fallthroughs
Diffstat (limited to 'lib/compiler/src/beam_dead.erl')
-rw-r--r-- | lib/compiler/src/beam_dead.erl | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_dead.erl b/lib/compiler/src/beam_dead.erl index d00264eb6e..f4515ba2a7 100644 --- a/lib/compiler/src/beam_dead.erl +++ b/lib/compiler/src/beam_dead.erl @@ -98,6 +98,12 @@ move_move_into_block([], Acc) -> reverse(Acc). forward(Is, Lc) -> forward(Is, gb_trees:empty(), Lc, []). +forward([{move,_,_}=Move|[{label,L}|_]=Is], D, Lc, Acc) -> + %% move/2 followed by jump/1 is optimized by backward/3. + forward([Move,{jump,{f,L}}|Is], D, Lc, Acc); +forward([{bif,_,_,_,_}=Bif|[{label,L}|_]=Is], D, Lc, Acc) -> + %% bif/4 followed by jump/1 is optimized by backward/3. + forward([Bif,{jump,{f,L}}|Is], D, Lc, Acc); forward([{block,[]}|Is], D, Lc, Acc) -> %% Empty blocks can prevent optimizations. forward(Is, D, Lc, Acc); |