Improve independence analysis

This commit is contained in:
Hans Svensson 2023-08-23 13:16:57 +02:00
parent 3b0ca28c8e
commit 17229f4014

View File

@ -1141,10 +1141,15 @@ independent({i, _, I}, {i, _, J}) ->
StackI = lists:member(?a, [WI | RI]), StackI = lists:member(?a, [WI | RI]),
StackJ = lists:member(?a, [WJ | RJ]), StackJ = lists:member(?a, [WJ | RJ]),
ReadStoreI = [] /= [ x || {store, _} <- RI ],
ReadStoreJ = [] /= [ x || {store, _} <- RJ ],
if WI == pc; WJ == pc -> false; %% no jumps if WI == pc; WJ == pc -> false; %% no jumps
not (PureI or PureJ) -> false; %% at least one is pure not (PureI or PureJ) -> false; %% at least one is pure
StackI and StackJ -> false; %% cannot both use the stack StackI and StackJ -> false; %% cannot both use the stack
WI == WJ -> false; %% cannot write to the same register WI == WJ -> false; %% cannot write to the same register
ReadStoreI and not PureJ -> false; %% can't read store/state if other is impure
ReadStoreJ and not PureI -> false; %% can't read store/state if other is impure
true -> true ->
%% and cannot write to each other's inputs %% and cannot write to each other's inputs
not lists:member(WI, RJ) andalso not lists:member(WI, RJ) andalso