aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_clean.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-09-28 11:42:08 +0200
committerBjörn Gustavsson <[email protected]>2015-09-28 11:42:08 +0200
commit7ca56726d7b3c8e679273950978f9f1816d4b277 (patch)
tree6954a4a604adae35c95db80390dc43c7fd1fc3bc /lib/compiler/src/beam_clean.erl
parent51750b8bd4d4eb08aacd2ad2bb0ac13fd6d09746 (diff)
parent464ca2f8049feec6453d2d9a327f996662978e51 (diff)
downloadotp-7ca56726d7b3c8e679273950978f9f1816d4b277.tar.gz
otp-7ca56726d7b3c8e679273950978f9f1816d4b277.tar.bz2
otp-7ca56726d7b3c8e679273950978f9f1816d4b277.zip
Merge branch 'bjorn/compiler/misc'
* bjorn/compiler/misc: Move select_val optimization from beam_clean to beam_peep beam_type: Improve optimizations by keeping track of booleans beam_type: Improve optimization by keeping track of integers beam_type: Remove unused clause beam_type: Fix forgotten change of internal representation beam_dead: Improve optimization of literal binary matching beam_dead: Optimize select_val instructions Move out bit syntax optimizations from beam_block sys_core_fold: Extend the list of BIFs that return integers v3_codegen: Optimize matching of the final size-less binary segment Regain full coverage of beam_block
Diffstat (limited to 'lib/compiler/src/beam_clean.erl')
-rw-r--r--lib/compiler/src/beam_clean.erl20
1 files changed, 4 insertions, 16 deletions
diff --git a/lib/compiler/src/beam_clean.erl b/lib/compiler/src/beam_clean.erl
index 7d66985791..d9108c383d 100644
--- a/lib/compiler/src/beam_clean.erl
+++ b/lib/compiler/src/beam_clean.erl
@@ -190,17 +190,11 @@ replace([{test,Test,{f,Lbl},Ops}|Is], Acc, D) ->
replace([{test,Test,{f,Lbl},Live,Ops,Dst}|Is], Acc, D) ->
replace(Is, [{test,Test,{f,label(Lbl, D)},Live,Ops,Dst}|Acc], D);
replace([{select,I,R,{f,Fail0},Vls0}|Is], Acc, D) ->
- Vls1 = map(fun ({f,L}) -> {f,label(L, D)};
- (Other) -> Other end, Vls0),
+ Vls = map(fun ({f,L}) -> {f,label(L, D)};
+ (Other) -> Other
+ end, Vls0),
Fail = label(Fail0, D),
- case redundant_values(Vls1, Fail, []) of
- [] ->
- %% Oops, no choices left. The loader will not accept that.
- %% Convert to a plain jump.
- replace(Is, [{jump,{f,Fail}}|Acc], D);
- Vls ->
- replace(Is, [{select,I,R,{f,Fail},Vls}|Acc], D)
- end;
+ replace(Is, [{select,I,R,{f,Fail},Vls}|Acc], D);
replace([{'try',R,{f,Lbl}}|Is], Acc, D) ->
replace(Is, [{'try',R,{f,label(Lbl, D)}}|Acc], D);
replace([{'catch',R,{f,Lbl}}|Is], Acc, D) ->
@@ -241,12 +235,6 @@ label(Old, D) ->
{value,Val} -> Val;
none -> throw({error,{undefined_label,Old}})
end.
-
-redundant_values([_,{f,Fail}|Vls], Fail, Acc) ->
- redundant_values(Vls, Fail, Acc);
-redundant_values([Val,Lbl|Vls], Fail, Acc) ->
- redundant_values(Vls, Fail, [Lbl,Val|Acc]);
-redundant_values([], _, Acc) -> reverse(Acc).
%%%
%%% Final fixup of bs_start_match2/5,bs_save2/bs_restore2 instructions for