diff options
author | Björn Gustavsson <[email protected]> | 2019-05-23 10:43:17 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2019-05-23 10:43:17 +0200 |
commit | 242c3a7b2a51a4f95dbee3257f3a2f9130a1720e (patch) | |
tree | d55d6289772b7684f68befa23ebd712ad4ba7df5 /lib/compiler/src/beam_ssa_pre_codegen.erl | |
parent | 2dc34326153fe7af8b0cd7b33899ce93eb2153bd (diff) | |
parent | db4c234f442f43a0160dee71d9ca02c08c353ae9 (diff) | |
download | otp-242c3a7b2a51a4f95dbee3257f3a2f9130a1720e.tar.gz otp-242c3a7b2a51a4f95dbee3257f3a2f9130a1720e.tar.bz2 otp-242c3a7b2a51a4f95dbee3257f3a2f9130a1720e.zip |
Merge branch 'maint'
* maint:
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 878493e926..a5fcb91cc0 100644 --- a/lib/compiler/src/beam_ssa_pre_codegen.erl +++ b/lib/compiler/src/beam_ssa_pre_codegen.erl @@ -1527,12 +1527,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 |