From e6c42f382429b0f8e2edc8d5676f656f37a9a408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20L=C3=A5ng?= Date: Mon, 7 Mar 2016 13:14:07 +0100 Subject: hipe_icode_fp: Replace helper with lists:all --- lib/hipe/icode/hipe_icode_fp.erl | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'lib/hipe') 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 -- cgit v1.2.3