diff options
author | Magnus Lång <[email protected]> | 2016-03-07 13:14:07 +0100 |
---|---|---|
committer | Magnus Lång <[email protected]> | 2016-03-07 13:14:07 +0100 |
commit | e6c42f382429b0f8e2edc8d5676f656f37a9a408 (patch) | |
tree | 0ba93e0476124e81e4017c524d81b8ec3655256c | |
parent | 19374264924eb00d9475f6e694335e81a3f31c45 (diff) | |
download | otp-e6c42f382429b0f8e2edc8d5676f656f37a9a408.tar.gz otp-e6c42f382429b0f8e2edc8d5676f656f37a9a408.tar.bz2 otp-e6c42f382429b0f8e2edc8d5676f656f37a9a408.zip |
hipe_icode_fp: Replace helper with lists:all
-rw-r--r-- | lib/hipe/icode/hipe_icode_fp.erl | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/hipe/icode/hipe_icode_fp.erl b/lib/hipe/icode/hipe_icode_fp.erl index 3098e629ca..4f404d458c 100644 --- a/lib/hipe/icode/hipe_icode_fp.erl +++ b/lib/hipe/icode/hipe_icode_fp.erl @@ -850,12 +850,15 @@ filter_map(Map, NofPreds) -> filter_map([{Var, Bindings}|Left], NofPreds, Map) -> case length(Bindings) =:= NofPreds of true -> + BindingsAllAssigned = lists:all(fun({_, {assigned, _}}) -> true; + ({_, _}) -> false + end, Bindings), case all_args_equal(Bindings) of true -> NewBinding = case hd(Bindings) of {Pred, {assigned, FVar0}} when is_integer(Pred) -> - case bindings_all_assigned(Bindings) of + case BindingsAllAssigned of true -> {assigned, FVar0}; false -> FVar0 end; @@ -873,7 +876,7 @@ filter_map([{Var, Bindings}|Left], NofPreds, Map) -> Map#{phi => [{PhiDst, PhiArgs}]} end, NewBinding = - case bindings_all_assigned(Bindings) of + case BindingsAllAssigned of true -> {assigned, PhiDst}; false -> PhiDst end, @@ -885,13 +888,6 @@ filter_map([{Var, Bindings}|Left], NofPreds, Map) -> filter_map([], _NofPreds, Map) -> Map. --spec bindings_all_assigned(incoming_fvars()) -> boolean(). - -bindings_all_assigned([]) -> true; -bindings_all_assigned([{_, {assigned, _}}|Left]) -> - bindings_all_assigned(Left); -bindings_all_assigned(_) -> false. - -spec all_args_equal(incoming_fvars()) -> boolean(). %% all_args_equal returns true if the mapping for a variable is the |