aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2012-11-26 12:28:07 +0100
committerBjörn Gustavsson <[email protected]>2012-11-26 14:00:37 +0100
commitdebb6589b998b37d02a52d55f12a2117b2dd0e38 (patch)
tree26933c0a8b929b03b1c1d0b81c17e912ad211f0e
parent4b01f5b318a866fc5fb9392ddadd1fa54f862692 (diff)
downloadotp-debb6589b998b37d02a52d55f12a2117b2dd0e38.tar.gz
otp-debb6589b998b37d02a52d55f12a2117b2dd0e38.tar.bz2
otp-debb6589b998b37d02a52d55f12a2117b2dd0e38.zip
beam_utils: Improve is_not_used/3 for bit syntax matching
-rw-r--r--lib/compiler/src/beam_utils.erl18
1 files changed, 5 insertions, 13 deletions
diff --git a/lib/compiler/src/beam_utils.erl b/lib/compiler/src/beam_utils.erl
index 8b661e6901..8af0447f63 100644
--- a/lib/compiler/src/beam_utils.erl
+++ b/lib/compiler/src/beam_utils.erl
@@ -263,19 +263,11 @@ check_liveness(R, [{test,_,{f,Fail},As}|Is], St0) ->
{_,_}=Other -> Other
end
end;
-check_liveness(R, [{test,_,{f,Fail},Live,Ss,_}|Is], St0) ->
- case R of
- {x,X} ->
- case X < Live orelse member(R, Ss) of
- true -> {used,St0};
- false -> check_liveness_at(R, Fail, St0)
- end;
- {y,_} ->
- case check_liveness_at(R, Fail, St0) of
- {killed,St} -> check_liveness(R, Is, St);
- {_,_}=Other -> Other
- end
- end;
+check_liveness(R, [{test,Op,Fail,Live,Ss,Dst}|Is], St) ->
+ %% Check this instruction as a block to get a less conservative
+ %% result if the caller is is_not_used/3.
+ Block = [{set,[Dst],Ss,{alloc,Live,{bif,Op,Fail}}}],
+ check_liveness(R, [{block,Block}|Is], St);
check_liveness(R, [{select,_,R,_,_}|_], St) ->
{used,St};
check_liveness(R, [{select,_,_,Fail,Branches}|_], St) ->