aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/ssa
diff options
context:
space:
mode:
authorMagnus Lång <[email protected]>2016-11-09 18:47:12 +0100
committerMagnus Lång <[email protected]>2016-11-15 14:58:59 +0100
commitc91c523f1ca58644267402325b6fb59d65049829 (patch)
treec355fdf2a07ff894cbb8f1cc1bea7abcb889dd0b /lib/hipe/ssa
parentca0fbe891d0f8278b4824d6b2c5db4cd01fcef5c (diff)
downloadotp-c91c523f1ca58644267402325b6fb59d65049829.tar.gz
otp-c91c523f1ca58644267402325b6fb59d65049829.tar.bz2
otp-c91c523f1ca58644267402325b6fb59d65049829.zip
hipe_rtl: drop alub dest when unused
Diffstat (limited to 'lib/hipe/ssa')
-rw-r--r--lib/hipe/ssa/hipe_ssa.inc22
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/hipe/ssa/hipe_ssa.inc b/lib/hipe/ssa/hipe_ssa.inc
index 83ab320306..b511bb6f25 100644
--- a/lib/hipe/ssa/hipe_ssa.inc
+++ b/lib/hipe/ssa/hipe_ssa.inc
@@ -1,4 +1,4 @@
-%% -*- erlang-indent-level: 2 -*-
+%% -*- mode: erlang; erlang-indent-level: 2 -*-
%%
%% %CopyrightBegin%
%%
@@ -943,9 +943,9 @@ do_code([Instr|Instrs], LiveOut, Changed, Acc) ->
false ->
do_code(Instrs, LiveIn, Changed, [Instr|Acc]);
true ->
- case ?CODE:is_safe(Instr) of
+ case ?CODE:is_call(Instr) of
true ->
- case ?CODE:is_call(Instr) of
+ case ?CODE:is_safe(Instr) of
true ->
case ?CODE:call_continuation(Instr) of
[] ->
@@ -955,11 +955,6 @@ do_code([Instr|Instrs], LiveOut, Changed, Acc) ->
do_code(Instrs, LiveOut, true, [NewInstr|Acc])
end;
false ->
- do_code(Instrs, LiveOut, true, Acc)
- end;
- false -> %% not a safe instruction - cannot be removed
- case ?CODE:is_call(Instr) of
- true ->
case ?CODE:call_dstlist(Instr) of
[] -> %% result was not used anyway; no change
do_code(Instrs, LiveIn, Changed, [Instr|Acc]);
@@ -968,9 +963,14 @@ do_code([Instr|Instrs], LiveOut, Changed, Acc) ->
do_code(Instrs, LiveIn, true, [NewInstr|Acc]);
[_|_] -> %% calls with multiple dests are left untouched
do_code(Instrs, LiveIn, Changed, [Instr|Acc])
- end;
- false ->
- do_code(Instrs, LiveIn, Changed, [Instr|Acc])
+ end
+ end;
+ false ->
+ case ?CODE:reduce_unused(Instr) of
+ false -> % not a safe instruction - cannot be removed
+ do_code(Instrs, LiveIn, Changed, [Instr|Acc]);
+ Replacement ->
+ do_code(lists:reverse(Replacement, Instrs), LiveOut, true, Acc)
end
end
end;