diff options
author | Björn Gustavsson <[email protected]> | 2019-08-02 10:39:55 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2019-08-02 10:39:55 +0200 |
commit | e1a2c49be73a8bafdae0aabb32d83c3e9a64c652 (patch) | |
tree | bb8df95164e472fcf578d2cc761b7d7a591c4a70 /lib/compiler/src/beam_ssa_opt.erl | |
parent | 2c6fa6c21cc373f67bddef658b53fd8ababff127 (diff) | |
parent | 773e3d0f4a2d978a7ec6be9ed639eb1941d92d6c (diff) | |
download | otp-e1a2c49be73a8bafdae0aabb32d83c3e9a64c652.tar.gz otp-e1a2c49be73a8bafdae0aabb32d83c3e9a64c652.tar.bz2 otp-e1a2c49be73a8bafdae0aabb32d83c3e9a64c652.zip |
Merge branch 'bjorn/compiler/fix-no_type_opt/ERL-997' of https://github.com/bjorng/otp into maint
OTP-15969
* 'bjorn/compiler/fix-no_type_opt/ERL-997' of https://github.com/bjorng/otp:
Fix compiler crash when compiling with +no_type_opt
Diffstat (limited to 'lib/compiler/src/beam_ssa_opt.erl')
-rw-r--r-- | lib/compiler/src/beam_ssa_opt.erl | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/compiler/src/beam_ssa_opt.erl b/lib/compiler/src/beam_ssa_opt.erl index 229edc6a1d..d87c66c272 100644 --- a/lib/compiler/src/beam_ssa_opt.erl +++ b/lib/compiler/src/beam_ssa_opt.erl @@ -1939,12 +1939,24 @@ verify_merge_is(_) -> is_merge_allowed(_, #b_blk{}, #b_blk{is=[#b_set{op=peek_message}|_]}) -> false; -is_merge_allowed(L, #b_blk{last=#b_br{}}=Blk, #b_blk{}) -> +is_merge_allowed(L, #b_blk{last=#b_br{}}=Blk, #b_blk{is=Is}) -> %% The predecessor block must have exactly one successor (L) for %% the merge to be safe. case beam_ssa:successors(Blk) of - [L] -> true; - [_|_] -> false + [L] -> + case Is of + [#b_set{op=phi,args=[_]}|_] -> + %% The type optimizer pass must have been + %% turned off, since it would have removed this + %% redundant phi node. Refuse to merge the blocks + %% to ensure that this phi node remains at the + %% beginning of a block. + false; + _ -> + true + end; + [_|_] -> + false end; is_merge_allowed(_, #b_blk{last=#b_switch{}}, #b_blk{}) -> false. |