aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-05-25 06:15:18 +0200
committerBjörn Gustavsson <[email protected]>2016-05-25 16:41:27 +0200
commita6edfacf112f3048630bbd002b1eb8d933ebb2df (patch)
treed223d98f8864b7fd6fe807ac00a3802ccda4aecc /lib/compiler
parentc0a93fe2b9e36e00e9e3ebdec7840889ac571f6a (diff)
downloadotp-a6edfacf112f3048630bbd002b1eb8d933ebb2df.tar.gz
otp-a6edfacf112f3048630bbd002b1eb8d933ebb2df.tar.bz2
otp-a6edfacf112f3048630bbd002b1eb8d933ebb2df.zip
beam_utils: Simplify handling of 'return' to eliminate uncovered line
Y registers are killed by the deallocate/1 instruction, so there is no need to handle Y register in the return/1 instruction in check_liveness/3. There is also no need to keep check_liveness_live_ret/3 since it is only used in one place.
Diffstat (limited to 'lib/compiler')
-rw-r--r--lib/compiler/src/beam_utils.erl15
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/compiler/src/beam_utils.erl b/lib/compiler/src/beam_utils.erl
index 47703b4aa3..cc5bb4b98b 100644
--- a/lib/compiler/src/beam_utils.erl
+++ b/lib/compiler/src/beam_utils.erl
@@ -324,8 +324,11 @@ check_liveness(R, [{deallocate,_}|Is], St) ->
{y,_} -> {killed,St};
_ -> check_liveness(R, Is, St)
end;
-check_liveness(R, [return|_], St) ->
- check_liveness_live_ret(R, 1, St);
+check_liveness({x,_}=R, [return|_], St) ->
+ case R of
+ {x,0} -> {used,St};
+ {x,_} -> {killed,St}
+ end;
check_liveness(R, [{call,Live,_}|Is], St) ->
case R of
{x,X} when X < Live -> {used,St};
@@ -534,14 +537,6 @@ check_liveness_at(R, Lbl, #live{lbl=Ll,res=ResMemorized}=St0) ->
check_liveness_ret(R, R, St) -> {used,St};
check_liveness_ret(_, _, St) -> {killed,St}.
-check_liveness_live_ret({x,R}, Live, St) ->
- if
- R < Live -> {used,St};
- true -> {killed,St}
- end;
-check_liveness_live_ret({y,_}, _, St) ->
- {killed,St}.
-
check_liveness_fail(_, _, _, 0, St) ->
{killed,St};
check_liveness_fail(R, Op, Args, Fail, St) ->