aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-10-13 10:40:30 +0200
committerGitHub <[email protected]>2017-10-13 10:40:30 +0200
commit094e0a91fc1046462c4dd5accd48b8e2eb7a4c9c (patch)
treedc305b713f0ba3f3c615b1b39c4b345db6649831 /lib/hipe
parent805c5b9b4627eacc2fb13d234c553ae476a2c3dd (diff)
parent119713b4d9ad6649aa5f1d0bf492e2f35a0ced01 (diff)
downloadotp-094e0a91fc1046462c4dd5accd48b8e2eb7a4c9c.tar.gz
otp-094e0a91fc1046462c4dd5accd48b8e2eb7a4c9c.tar.bz2
otp-094e0a91fc1046462c4dd5accd48b8e2eb7a4c9c.zip
Merge pull request #1596 from bjorng/bjorn/enhance-try-catch
(Slightly) optimize catch and try/catch OTP-14683
Diffstat (limited to 'lib/hipe')
-rw-r--r--lib/hipe/icode/hipe_beam_to_icode.erl6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/hipe/icode/hipe_beam_to_icode.erl b/lib/hipe/icode/hipe_beam_to_icode.erl
index 2abecf7f18..167f5c67bb 100644
--- a/lib/hipe/icode/hipe_beam_to_icode.erl
+++ b/lib/hipe/icode/hipe_beam_to_icode.erl
@@ -2296,6 +2296,12 @@ split_code([First|Code], Label, Instr) ->
split_code([Instr|Code], Label, Instr, Prev, As) when Prev =:= Label ->
split_code_final(Code, As); % drop both label and instruction
+split_code([{icode_end_try}|_]=Code, Label, {try_case,_}, Prev, As)
+ when Prev =:= Label ->
+ %% The try_case has been replaced with try_end as an optimization.
+ %% Keep this instruction, since it might be the only try_end instruction
+ %% for this try/catch block.
+ split_code_final(Code, As); % drop label
split_code([Other|_Code], Label, Instr, Prev, _As) when Prev =:= Label ->
?EXIT({missing_instr_after_label, Label, Instr, [Other, Prev | _As]});
split_code([Other|Code], Label, Instr, Prev, As) ->