aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_clean.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-05-09 06:40:30 +0200
committerBjörn Gustavsson <[email protected]>2018-08-17 09:51:00 +0200
commit62fac82a67f1a8b82c144b3000b6d57a1f815f82 (patch)
tree90da0b56b0c1b9bfe1cc940a3f609762ab28d80f /lib/compiler/src/beam_clean.erl
parent3fc40fd57fa01b097b4c363860c4d4762e13db8b (diff)
downloadotp-62fac82a67f1a8b82c144b3000b6d57a1f815f82.tar.gz
otp-62fac82a67f1a8b82c144b3000b6d57a1f815f82.tar.bz2
otp-62fac82a67f1a8b82c144b3000b6d57a1f815f82.zip
beam_bs: Remove optimizations that are easier done on SSA format
The removal of redundant bs_restore2 instructions is done easier on the SSA format. Keep the rest of the optimizations, because they are easier to do on the BEAM instructions.
Diffstat (limited to 'lib/compiler/src/beam_clean.erl')
-rw-r--r--lib/compiler/src/beam_clean.erl19
1 files changed, 0 insertions, 19 deletions
diff --git a/lib/compiler/src/beam_clean.erl b/lib/compiler/src/beam_clean.erl
index 207f1c4deb..5a9023c259 100644
--- a/lib/compiler/src/beam_clean.erl
+++ b/lib/compiler/src/beam_clean.erl
@@ -22,7 +22,6 @@
-module(beam_clean).
-export([module/2]).
--export([bs_clean_saves/1]).
-export([clean_labels/1]).
-import(lists, [foldl/3,reverse/1]).
@@ -41,15 +40,6 @@ module({Mod,Exp,Attr,Fs0,_}, Opts) ->
Fs = maybe_remove_lines(Fs3, Opts),
{ok,{Mod,Exp,Attr,Fs,Lc}}.
-%% Remove all bs_save2/2 instructions not referenced by a bs_restore2/2.
-
--spec bs_clean_saves([beam_utils:instruction()]) ->
- [beam_utils:instruction()].
-
-bs_clean_saves(Is) ->
- Needed = bs_restores(Is, []),
- bs_clean_saves_1(Is, gb_sets:from_list(Needed), []).
-
%% Determine the rootset, i.e. exported functions and
%% the on_load function (if any).
@@ -283,15 +273,6 @@ bs_replace([I|Is], Dict, Acc) ->
bs_replace(Is, Dict, [I|Acc]);
bs_replace([], _, Acc) -> reverse(Acc).
-bs_clean_saves_1([{bs_save2,_,{_,_}=SavePoint}=I|Is], Needed, Acc) ->
- case gb_sets:is_member(SavePoint, Needed) of
- false -> bs_clean_saves_1(Is, Needed, Acc);
- true -> bs_clean_saves_1(Is, Needed, [I|Acc])
- end;
-bs_clean_saves_1([I|Is], Needed, Acc) ->
- bs_clean_saves_1(Is, Needed, [I|Acc]);
-bs_clean_saves_1([], _, Acc) -> reverse(Acc).
-
%%%
%%% Remove line instructions if requested.
%%%