Simplify JUMPIF on true/false
This commit is contained in:
parent
4a8fb5ba05
commit
ef120a7194
@ -1137,10 +1137,13 @@ block(Blk = #blk{code = [{switch, Arg, Type, Alts, Default} | Code],
|
|||||||
_ -> FalseCode ++ [{jump, RestRef}]
|
_ -> FalseCode ++ [{jump, RestRef}]
|
||||||
end,
|
end,
|
||||||
case lists:usort(Alts) == [missing] of
|
case lists:usort(Alts) == [missing] of
|
||||||
true ->
|
true -> {Blk#blk{code = [{jump, DefRef}]}, [], []};
|
||||||
{Blk#blk{code = [{jump, DefRef}]}, [], []};
|
|
||||||
false ->
|
false ->
|
||||||
{Blk#blk{code = ElseCode}, [{jumpif, Arg, ThenRef}], ThenBlk}
|
case Arg of
|
||||||
|
?i(false) -> {Blk#blk{code = ElseCode}, [], ThenBlk};
|
||||||
|
?i(true) -> {Blk#blk{code = []}, [{jump, ThenRef}], ThenBlk};
|
||||||
|
_ -> {Blk#blk{code = ElseCode}, [{jumpif, Arg, ThenRef}], ThenBlk}
|
||||||
|
end
|
||||||
end;
|
end;
|
||||||
tuple ->
|
tuple ->
|
||||||
[TCode] = Alts,
|
[TCode] = Alts,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user