127
127
% %% on the program state.
128
128
% %%
129
129
130
- -import (lists , [reverse /1 ,reverse /2 ,foldl /3 , dropwhile / 2 ]).
130
+ -import (lists , [reverse /1 ,reverse /2 ,foldl /3 ]).
131
131
132
132
module ({Mod ,Exp ,Attr ,Fs0 ,Lc }, _Opt ) ->
133
133
Fs = [function (F ) || F <- Fs0 ],
@@ -509,10 +509,7 @@ rem_unused([{label,Lbl}=I|Is0], Used, [Prev|_]=Acc) ->
509
509
case gb_sets :is_member (Lbl , Used ) of
510
510
false ->
511
511
Is = case is_unreachable_after (Prev ) of
512
- true ->
513
- dropwhile (fun ({label ,_ }) -> false ;
514
- (_ ) -> true
515
- end , Is0 );
512
+ true -> drop_upto_label (Is0 );
516
513
false -> Is0
517
514
end ,
518
515
rem_unused (Is , Used , Acc );
@@ -533,6 +530,10 @@ initial_labels([{label,Lbl}|Is], Acc) ->
533
530
initial_labels ([{func_info ,_ ,_ ,_ },{label ,Lbl }|_ ], Acc ) ->
534
531
gb_sets :from_list ([Lbl |Acc ]).
535
532
533
+ drop_upto_label ([{label ,_ }|_ ]= Is ) -> Is ;
534
+ drop_upto_label ([_ |Is ]) -> drop_upto_label (Is );
535
+ drop_upto_label ([]) -> [].
536
+
536
537
% % ulbl(Instruction, UsedGbSet) -> UsedGbSet'
537
538
% % Update the gb_set UsedGbSet with any function-local labels
538
539
% % (i.e. not with labels in call instructions) referenced by
0 commit comments