From 105e056cddaf765952d58813e2ec5c9bdfd4403c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Tue, 4 Sep 2012 12:40:26 +0200 Subject: Refactor removal of unused labels Since we always want to remove unused labels directly after code generation (whether we'll run the optimization passes or not), we can simplify the code by doing it in beam_a. --- lib/compiler/src/beam_a.erl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/compiler/src/beam_a.erl') diff --git a/lib/compiler/src/beam_a.erl b/lib/compiler/src/beam_a.erl index 3d073f63df..496b0aba41 100644 --- a/lib/compiler/src/beam_a.erl +++ b/lib/compiler/src/beam_a.erl @@ -28,8 +28,11 @@ module({Mod,Exp,Attr,Fs0,Lc}, _Opt) -> Fs = [function(F) || F <- Fs0], {ok,{Mod,Exp,Attr,Fs,Lc}}. -function({function,Name,Arity,CLabel,Is}) -> +function({function,Name,Arity,CLabel,Is0}) -> try + %% Remove unusued labels for cleanliness and to help + %% optimization passes and HiPE. + Is = beam_jump:remove_unused_labels(Is0), {function,Name,Arity,CLabel,Is} catch Class:Error -> -- cgit v1.2.3