aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-01-09 16:42:21 +0100
committerBjörn Gustavsson <[email protected]>2018-01-11 12:00:59 +0100
commit467ef356dbae0b53b824fcb71b3fc6899ced29a4 (patch)
tree3912f168fd65652299f17a8dd2bbf219332c59da
parentce67e91a851273c8aee58f7dad270c39f18fe0de (diff)
downloadotp-467ef356dbae0b53b824fcb71b3fc6899ced29a4.tar.gz
otp-467ef356dbae0b53b824fcb71b3fc6899ced29a4.tar.bz2
otp-467ef356dbae0b53b824fcb71b3fc6899ced29a4.zip
beam_utils: Correct handling of liveness for select_val
Since the select_val instruction never transfer directly to the next instruction, the incoming live registers should be ignored. This bug have not caused any problems yet, but it will in the future if we are to run the liveness optimizations again after the optimizations in beam_dead and beam_jump.
-rw-r--r--lib/compiler/src/beam_utils.erl3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/compiler/src/beam_utils.erl b/lib/compiler/src/beam_utils.erl
index a2795e625f..bb0f78eafc 100644
--- a/lib/compiler/src/beam_utils.erl
+++ b/lib/compiler/src/beam_utils.erl
@@ -902,7 +902,8 @@ live_opt([{test,_,Fail,Live,Ss,_}=I|Is], _, D, Acc) ->
Regs1 = x_live(Ss, Regs0),
Regs = live_join_label(Fail, D, Regs1),
live_opt(Is, Regs, D, [I|Acc]);
-live_opt([{select,_,Src,Fail,List}=I|Is], Regs0, D, Acc) ->
+live_opt([{select,_,Src,Fail,List}=I|Is], _, D, Acc) ->
+ Regs0 = 0,
Regs1 = x_live([Src], Regs0),
Regs = live_join_labels([Fail|List], D, Regs1),
live_opt(Is, Regs, D, [I|Acc]);