diff options
author | John Högberg <[email protected]> | 2019-08-07 09:44:28 +0200 |
---|---|---|
committer | John Högberg <[email protected]> | 2019-08-07 09:45:57 +0200 |
commit | fd6904ffd83ae32a06f99547d3b3b7c77feac87b (patch) | |
tree | 8188c336250cee206eeb64739a0ce83a88970480 /lib | |
parent | 0ac5f0177761ac68a22b8ebf691a20e470918dd6 (diff) | |
download | otp-fd6904ffd83ae32a06f99547d3b3b7c77feac87b.tar.gz otp-fd6904ffd83ae32a06f99547d3b3b7c77feac87b.tar.bz2 otp-fd6904ffd83ae32a06f99547d3b3b7c77feac87b.zip |
beam_ssa_type: Remove unreachable code
Now that impossible branches are skipped altogether, it's no
longer possible to encounter get_tuple_element with a 'none'
argument.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compiler/src/beam_ssa_type.erl | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/compiler/src/beam_ssa_type.erl b/lib/compiler/src/beam_ssa_type.erl index 364a87f67e..d93191c689 100644 --- a/lib/compiler/src/beam_ssa_type.erl +++ b/lib/compiler/src/beam_ssa_type.erl @@ -481,17 +481,12 @@ simplify(#b_set{op={bif,Op},args=Args}=I, Ts) -> eval_bif(beam_ssa:add_anno(float_op, AnnoArgs, I), Ts) end; simplify(#b_set{op=get_tuple_element,args=[Tuple,#b_literal{val=N}]}=I, Ts) -> - case normalized_type(Tuple, Ts) of - #t_tuple{size=Size,elements=Es} when Size > N -> - ElemType = beam_types:get_element_type(N + 1, Es), - case beam_types:get_singleton_value(ElemType) of - {ok, Val} -> #b_literal{val=Val}; - error -> I - end; - none -> - %% Will never be executed because of type conflict. - %% #b_literal{val=ignored}; - I + #t_tuple{size=Size,elements=Es} = normalized_type(Tuple, Ts), + true = Size > N, %Assertion. + ElemType = beam_types:get_element_type(N + 1, Es), + case beam_types:get_singleton_value(ElemType) of + {ok, Val} -> #b_literal{val=Val}; + error -> I end; simplify(#b_set{op=is_nonempty_list,args=[Src]}=I, Ts) -> case normalized_type(Src, Ts) of |