aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-12-06 10:18:07 +0100
committerGitHub <[email protected]>2018-12-06 10:18:07 +0100
commit5cc2687c40882beac4d3eac20e279c2cbf6d0134 (patch)
tree517f3de2bebfb5917e70239dbe8d62b755e38bb2 /lib/compiler/src
parent66a3c14bf570e09cbe98cdaa10ee1873def71084 (diff)
parent235bf91dc47888e16224e4a25e636cc741173d7f (diff)
downloadotp-5cc2687c40882beac4d3eac20e279c2cbf6d0134.tar.gz
otp-5cc2687c40882beac4d3eac20e279c2cbf6d0134.tar.bz2
otp-5cc2687c40882beac4d3eac20e279c2cbf6d0134.zip
Merge pull request #2043 from bjorng/bjorn/compiler/tuple_size
beam_ssa_pre_codegen: Fix an internal consistency failure
Diffstat (limited to 'lib/compiler/src')
-rw-r--r--lib/compiler/src/beam_ssa_pre_codegen.erl10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/compiler/src/beam_ssa_pre_codegen.erl b/lib/compiler/src/beam_ssa_pre_codegen.erl
index 32232e9b9f..56fe9b4793 100644
--- a/lib/compiler/src/beam_ssa_pre_codegen.erl
+++ b/lib/compiler/src/beam_ssa_pre_codegen.erl
@@ -1994,13 +1994,15 @@ reserve_zregs(Blocks, Intervals, Res) ->
beam_ssa:fold_rpo(F, [0], Res, Blocks).
reserve_zreg([#b_set{op={bif,tuple_size},dst=Dst},
- #b_set{op={bif,'=:='},args=[Dst,Val]}], _Last, ShortLived, A0) ->
- case Val of
- #b_literal{val=Arity} when Arity bsr 32 =:= 0 ->
+ #b_set{op={bif,'=:='},args=[Dst,Val]}], Last, ShortLived, A0) ->
+ case {Val,Last} of
+ {#b_literal{val=Arity},#b_br{}} when Arity bsr 32 =:= 0 ->
%% These two instructions can be combined to a test_arity
%% instruction provided that the arity variable is short-lived.
reserve_zreg_1(Dst, ShortLived, A0);
- _ ->
+ {_,_} ->
+ %% Either the arity is too big, or the boolean value from
+ %% '=:=' will be returned.
A0
end;
reserve_zreg([#b_set{op={bif,tuple_size},dst=Dst}],