aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_utils.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2012-12-06 14:13:41 +0100
committerBjörn Gustavsson <[email protected]>2012-12-06 14:13:41 +0100
commit5b40d5502f008f9c44bc4a3bd9037439e35ce0a7 (patch)
tree2dcc22b52d74b73b08d129d98c8afc541634600e /lib/compiler/src/beam_utils.erl
parent1f1818d49ccb5bf1a04fadace100a3e3cf95b52f (diff)
parentc38a6726500cd726dd3e605b3be389ee96df131c (diff)
downloadotp-5b40d5502f008f9c44bc4a3bd9037439e35ce0a7.tar.gz
otp-5b40d5502f008f9c44bc4a3bd9037439e35ce0a7.tar.bz2
otp-5b40d5502f008f9c44bc4a3bd9037439e35ce0a7.zip
Merge branch 'bjorn/compiler/minor-optimization-polishing/OTP-10193'
* bjorn/compiler/minor-optimization-polishing/OTP-10193: beam_bsm: Improve handling of bs_start_match2 instructions beam_utils: Improve is_not_used/3 for bit syntax matching beam_bsm: Make the optimization applicable in more circumstances beam_jump: Move bs_context_to_binary/1 + exit instruction
Diffstat (limited to 'lib/compiler/src/beam_utils.erl')
-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) ->