diff options
author | Björn Gustavsson <[email protected]> | 2016-11-18 12:06:42 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-11-18 12:06:42 +0100 |
commit | 79653c709f854e6fadd719ef5f079f66219c6bdf (patch) | |
tree | 2f2a3a1a3b1a06a5e458424da5cb88f9733ec56f /lib/compiler/src/beam_jump.erl | |
parent | f578f6c57438ac7dd11a3d113406a104f4064b26 (diff) | |
parent | 09f170e35cf9df8438ae42d48b51becff167b5b4 (diff) | |
download | otp-79653c709f854e6fadd719ef5f079f66219c6bdf.tar.gz otp-79653c709f854e6fadd719ef5f079f66219c6bdf.tar.bz2 otp-79653c709f854e6fadd719ef5f079f66219c6bdf.zip |
Merge branch 'bjorn/compiler/guards/PR-1232/OTP-14042'
* bjorn/compiler/guards/PR-1232/OTP-14042:
compile_SUITE: Make sure that guards are optimized
beam_dead: Remove redundant 'or' instruction
beam_dead: Remove redundant 'bif' instructions
Add test using LFE-generated Core Erlang modules
Remove beam_bool
v3_kernel: Generate optimized code for guards
sys_core_fold: Remove unnecessary calls to opt_bool_case/1
record_SUITE: Strengthen test of record access in guards
Diffstat (limited to 'lib/compiler/src/beam_jump.erl')
-rw-r--r-- | lib/compiler/src/beam_jump.erl | 32 |
1 files changed, 1 insertions, 31 deletions
diff --git a/lib/compiler/src/beam_jump.erl b/lib/compiler/src/beam_jump.erl index 5311ce7379..e096270d8c 100644 --- a/lib/compiler/src/beam_jump.erl +++ b/lib/compiler/src/beam_jump.erl @@ -23,7 +23,7 @@ -export([module/2, is_unreachable_after/1,is_exit_instruction/1, - remove_unused_labels/1,is_label_used_in/2]). + remove_unused_labels/1]). %%% The following optimisations are done: %%% @@ -473,36 +473,6 @@ is_exit_instruction({try_case_end,_}) -> true; is_exit_instruction({badmatch,_}) -> true; is_exit_instruction(_) -> false. -%% is_label_used_in(LabelNumber, [Instruction]) -> boolean() -%% Check whether the label is used in the instruction sequence -%% (including inside blocks). - -is_label_used_in(Lbl, Is) -> - is_label_used_in_1(Is, Lbl, cerl_sets:new()). - -is_label_used_in_1([{block,Block}|Is], Lbl, Empty) -> - lists:any(fun(I) -> is_label_used_in_block(I, Lbl) end, Block) - orelse is_label_used_in_1(Is, Lbl, Empty); -is_label_used_in_1([I|Is], Lbl, Empty) -> - Used = ulbl(I, Empty), - cerl_sets:is_element(Lbl, Used) orelse is_label_used_in_1(Is, Lbl, Empty); -is_label_used_in_1([], _, _) -> false. - -is_label_used_in_block({set,_,_,Info}, Lbl) -> - case Info of - {bif,_,{f,F}} -> F =:= Lbl; - {alloc,_,{gc_bif,_,{f,F}}} -> F =:= Lbl; - {alloc,_,{put_map,_,{f,F}}} -> F =:= Lbl; - {get_map_elements,{f,F}} -> F =:= Lbl; - {try_catch,_,{f,F}} -> F =:= Lbl; - {alloc,_,_} -> false; - {put_tuple,_} -> false; - {get_tuple_element,_} -> false; - {set_tuple_element,_} -> false; - {line,_} -> false; - _ when is_atom(Info) -> false - end. - %% remove_unused_labels(Instructions0) -> Instructions %% Remove all unused labels. Also remove unreachable %% instructions following labels that are removed. |