diff options
author | Erlang/OTP <[email protected]> | 2019-05-29 13:24:41 +0200 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2019-05-29 13:24:41 +0200 |
commit | 1f61a273a53ac8fe48be1de0c86b33c82a84ebbd (patch) | |
tree | be78aff78593351f3af0037cc184a53a1c56b8a6 /lib/compiler/src/beam_ssa_pre_codegen.erl | |
parent | 787a7684b02a01818eb99abc0f6a168250e192a9 (diff) | |
parent | 7173fb8984d1822cc9c081f094841fb755f800fc (diff) | |
download | otp-1f61a273a53ac8fe48be1de0c86b33c82a84ebbd.tar.gz otp-1f61a273a53ac8fe48be1de0c86b33c82a84ebbd.tar.bz2 otp-1f61a273a53ac8fe48be1de0c86b33c82a84ebbd.zip |
Merge branch 'bjorn/compiler/fix-receive-patch/ERL-950/OTP-15832' into maint-22
* bjorn/compiler/fix-receive-patch/ERL-950/OTP-15832:
Eliminate compiler crash when compiling complex receive statements
Diffstat (limited to 'lib/compiler/src/beam_ssa_pre_codegen.erl')
-rw-r--r-- | lib/compiler/src/beam_ssa_pre_codegen.erl | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/compiler/src/beam_ssa_pre_codegen.erl b/lib/compiler/src/beam_ssa_pre_codegen.erl index bf99e8fc26..9af72afca7 100644 --- a/lib/compiler/src/beam_ssa_pre_codegen.erl +++ b/lib/compiler/src/beam_ssa_pre_codegen.erl @@ -1415,12 +1415,15 @@ fix_receive([], _Defs, Blocks, Count) -> find_loop_exit([L1,L2|_Ls], Blocks) -> Path1 = beam_ssa:rpo([L1], Blocks), Path2 = beam_ssa:rpo([L2], Blocks), - find_loop_exit_1(reverse(Path1), reverse(Path2), none); + find_loop_exit_1(Path1, cerl_sets:from_list(Path2)); find_loop_exit(_, _) -> none. -find_loop_exit_1([H|T1], [H|T2], _) -> - find_loop_exit_1(T1, T2, H); -find_loop_exit_1(_, _, Exit) -> Exit. +find_loop_exit_1([H|T], OtherPath) -> + case cerl_sets:is_element(H, OtherPath) of + true -> H; + false -> find_loop_exit_1(T, OtherPath) + end; +find_loop_exit_1([], _) -> none. %% find_rm_blocks(StartLabel, Blocks) -> [Label]. %% Find all blocks that start with remove_message within the receive |