Fix bug in short-cut for IS_NIL
This commit is contained in:
parent
47ad607dd5
commit
e6b5c5a526
@ -1155,18 +1155,20 @@ r_swap_write(Pre, I, Code0 = [J | Code]) ->
|
|||||||
r_swap_write(_, _, _) -> false.
|
r_swap_write(_, _, _) -> false.
|
||||||
|
|
||||||
%% Precompute instructions with known values
|
%% Precompute instructions with known values
|
||||||
r_constant_propagation(Cons = {i, _, {'CONS', R, _, _}}, [{i, Ann, {'IS_NIL', S, R}} | Code]) ->
|
r_constant_propagation(Cons = {i, Ann1, {'CONS', R, X, Xs}}, [{i, Ann, {'IS_NIL', S, R}} | Code]) ->
|
||||||
Store = {i, Ann, {'STORE', S, ?i(false)}},
|
Store = {i, Ann, {'STORE', S, ?i(false)}},
|
||||||
case R of
|
Cons1 = case R of
|
||||||
?a -> {[Store], Code};
|
?a -> {i, Ann1, {'CONS', ?void, X, Xs}};
|
||||||
_ -> {[Cons, Store], Code}
|
_ -> Cons
|
||||||
end;
|
end,
|
||||||
r_constant_propagation(Cons = {i, _, {'NIL', R}}, [{i, Ann, {'IS_NIL', S, R}} | Code]) ->
|
{[Cons1, Store], Code};
|
||||||
|
r_constant_propagation(Nil = {i, Ann1, {'NIL', R}}, [{i, Ann, {'IS_NIL', S, R}} | Code]) ->
|
||||||
Store = {i, Ann, {'STORE', S, ?i(true)}},
|
Store = {i, Ann, {'STORE', S, ?i(true)}},
|
||||||
case R of
|
Nil1 = case R of
|
||||||
?a -> {[Store], Code};
|
?a -> {i, Ann1, {'NIL', ?void}};
|
||||||
_ -> {[Cons, Store], Code}
|
_ -> Nil
|
||||||
end;
|
end,
|
||||||
|
{[Nil1, Store], Code};
|
||||||
r_constant_propagation({i, Ann, I}, Code) ->
|
r_constant_propagation({i, Ann, I}, Code) ->
|
||||||
case op_view(I) of
|
case op_view(I) of
|
||||||
false -> false;
|
false -> false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user