diff options
author | Björn Gustavsson <[email protected]> | 2019-01-08 10:22:35 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2019-01-11 14:53:58 +0100 |
commit | 25506b84b5f3f12c85b331881fbcb3f392c49d01 (patch) | |
tree | 5c8bec73e541aa8ce1ce27f26918dd77ebb6975b /lib/compiler/src | |
parent | aa5858203fedf89b97197cbaaf009ddcdbb5f641 (diff) | |
download | otp-25506b84b5f3f12c85b331881fbcb3f392c49d01.tar.gz otp-25506b84b5f3f12c85b331881fbcb3f392c49d01.tar.bz2 otp-25506b84b5f3f12c85b331881fbcb3f392c49d01.zip |
beam_ssa_type: Properly eliminate 'succeeded' instructions
When an instruction has been eliminated, the 'succeeded' instruction must
be eliminated.
Diffstat (limited to 'lib/compiler/src')
-rw-r--r-- | lib/compiler/src/beam_ssa_type.erl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/compiler/src/beam_ssa_type.erl b/lib/compiler/src/beam_ssa_type.erl index 95fc3bb0e9..752533ace7 100644 --- a/lib/compiler/src/beam_ssa_type.erl +++ b/lib/compiler/src/beam_ssa_type.erl @@ -153,8 +153,15 @@ opt_is([#b_set{args=Args0,dst=Dst}=I0|Is], Sub = Sub0#{Dst=>Lit}, opt_is(Is, Ts0, Ds0, Ls, Sub, Acc); #b_var{}=Var -> - Sub = Sub0#{Dst=>Var}, - opt_is(Is, Ts0, Ds0, Ls, Sub, Acc) + case Is of + [#b_set{op=succeeded,dst=SuccDst,args=[Dst]}] -> + %% We must remove this 'succeeded' instruction. + Sub = Sub0#{Dst=>Var,SuccDst=>#b_literal{val=true}}, + opt_is([], Ts0, Ds0, Ls, Sub, Acc); + _ -> + Sub = Sub0#{Dst=>Var}, + opt_is(Is, Ts0, Ds0, Ls, Sub, Acc) + end end; opt_is([], Ts, Ds, _Ls, Sub, Acc) -> {reverse(Acc),Ts,Ds,Sub}. |