diff options
author | Björn Gustavsson <[email protected]> | 2016-06-27 16:34:22 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-09-21 14:07:53 +0200 |
commit | 23ec13650736e617b1801585bdb87c0caffb70cf (patch) | |
tree | 1804ec8517cf0d24fc22b852d20e944c067fdcf1 /lib/compiler | |
parent | efb9081584eeb4cd790fb0b06c90c6cd62817018 (diff) | |
download | otp-23ec13650736e617b1801585bdb87c0caffb70cf.tar.gz otp-23ec13650736e617b1801585bdb87c0caffb70cf.tar.bz2 otp-23ec13650736e617b1801585bdb87c0caffb70cf.zip |
beam_jump: Simplify eliminate_fallthroughs/2
eliminate_fallthroughs/2 has special code to handle two labels next to
each other, but that does not seem to ever happen and there was one
line uncovered in is_label/1. Since inserting an extra jump between
two labels would not cause any real problems, remove the extra
handling of two consecutive labels.
Diffstat (limited to 'lib/compiler')
-rw-r--r-- | lib/compiler/src/beam_jump.erl | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/compiler/src/beam_jump.erl b/lib/compiler/src/beam_jump.erl index 48b5a32814..9030ea5446 100644 --- a/lib/compiler/src/beam_jump.erl +++ b/lib/compiler/src/beam_jump.erl @@ -208,21 +208,18 @@ sharable_with_try([]) -> true. %% Eliminate all fallthroughs. Return the result reversed. -eliminate_fallthroughs([I,{label,L}=Lbl|Is], Acc) -> - case is_unreachable_after(I) orelse is_label(I) of +eliminate_fallthroughs([{label,L}=Lbl|Is], [I|_]=Acc) -> + case is_unreachable_after(I) of false -> %% Eliminate fallthrough. - eliminate_fallthroughs(Is, [Lbl,{jump,{f,L}},I|Acc]); + eliminate_fallthroughs(Is, [Lbl,{jump,{f,L}}|Acc]); true -> - eliminate_fallthroughs(Is, [Lbl,I|Acc]) + eliminate_fallthroughs(Is, [Lbl|Acc]) end; eliminate_fallthroughs([I|Is], Acc) -> eliminate_fallthroughs(Is, [I|Acc]); eliminate_fallthroughs([], Acc) -> Acc. -is_label({label,_}) -> true; -is_label(_) -> false. - %%% %%% (2) Move short code sequences ending in an instruction that causes an exit %%% to the end of the function. |