aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2017-02-03 08:47:22 +0100
committerHans Bolinder <[email protected]>2017-02-03 08:47:22 +0100
commit67621f731008ff203d13e03f68edbea55b0d9054 (patch)
treebabc5a517f7eb1dc3ed43ec268ec51085faec746 /lib/hipe
parentaa71234438290f148ece18018ea4726924311bea (diff)
parent918eeb95d6d96ede31a85b07b008ae686dc0dfa8 (diff)
downloadotp-67621f731008ff203d13e03f68edbea55b0d9054.tar.gz
otp-67621f731008ff203d13e03f68edbea55b0d9054.tar.bz2
otp-67621f731008ff203d13e03f68edbea55b0d9054.zip
Merge branch 'hasse/dialyzer/memory_opt/OTP-14126' into maint
* hasse/dialyzer/memory_opt/OTP-14126: dialyzer: Increase time limit for tests dialyzer: Optimize typesig dialyzer: Optimize evaluation of complex code dialyzer: Optimize collection of variables
Diffstat (limited to 'lib/hipe')
-rw-r--r--lib/hipe/cerl/erl_types.erl15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/hipe/cerl/erl_types.erl b/lib/hipe/cerl/erl_types.erl
index 7edfbf65df..10e97ff54d 100644
--- a/lib/hipe/cerl/erl_types.erl
+++ b/lib/hipe/cerl/erl_types.erl
@@ -2243,16 +2243,21 @@ t_has_var_list([]) -> false.
-spec t_collect_vars(erl_type()) -> [erl_type()].
t_collect_vars(T) ->
- t_collect_vars(T, []).
+ Vs = t_collect_vars(T, maps:new()),
+ [V || {V, _} <- maps:to_list(Vs)].
--spec t_collect_vars(erl_type(), [erl_type()]) -> [erl_type()].
+-type ctab() :: #{erl_type() => 'any'}.
+
+-spec t_collect_vars(erl_type(), ctab()) -> ctab().
t_collect_vars(?var(_) = Var, Acc) ->
- ordsets:add_element(Var, Acc);
+ maps:put(Var, any, Acc);
t_collect_vars(?function(Domain, Range), Acc) ->
- ordsets:union(t_collect_vars(Domain, Acc), t_collect_vars(Range, []));
+ Acc1 = t_collect_vars(Domain, Acc),
+ t_collect_vars(Range, Acc1);
t_collect_vars(?list(Contents, Termination, _), Acc) ->
- ordsets:union(t_collect_vars(Contents, Acc), t_collect_vars(Termination, []));
+ Acc1 = t_collect_vars(Contents, Acc),
+ t_collect_vars(Termination, Acc1);
t_collect_vars(?product(Types), Acc) ->
t_collect_vars_list(Types, Acc);
t_collect_vars(?tuple(?any, ?any, ?any), Acc) ->