diff options
Diffstat (limited to 'lib/compiler/src/beam_clean.erl')
-rw-r--r-- | lib/compiler/src/beam_clean.erl | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/compiler/src/beam_clean.erl b/lib/compiler/src/beam_clean.erl index 76d86d116c..ef44bbfdf5 100644 --- a/lib/compiler/src/beam_clean.erl +++ b/lib/compiler/src/beam_clean.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2021. All Rights Reserved. +%% Copyright Ericsson AB 2000-2023. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ module({Mod,Exp,Attr,Fs0,_}, Opts) -> Order = [Lbl || {function,_,_,Lbl,_} <- Fs0], - All = maps:from_list([{Lbl,Func} || {function,_,_,Lbl,_}=Func <- Fs0]), + All = #{Lbl => Func || {function,_,_,Lbl,_}=Func <- Fs0}, WorkList = rootset(Fs0, Exp, Attr), Used = find_all_used(WorkList, All, sets:from_list(WorkList, [{version, 2}])), Fs1 = remove_unused(Order, Used, All), @@ -53,12 +53,8 @@ rootset(Fs, Root0, Attr) -> %% Remove the unused functions. -remove_unused([F|Fs], Used, All) -> - case sets:is_element(F, Used) of - false -> remove_unused(Fs, Used, All); - true -> [map_get(F, All)|remove_unused(Fs, Used, All)] - end; -remove_unused([], _, _) -> []. +remove_unused(Fs, Used, All) -> + [map_get(F, All) || F <- Fs, sets:is_element(F, Used)]. %% Find all used functions. |