aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_ssa_pre_codegen.erl
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2019-08-07 14:00:09 +0200
committerJohn Högberg <[email protected]>2019-08-07 16:47:25 +0200
commit6ae9975689858d0e0c9af0a36869c012bb3762c0 (patch)
tree973ca6e2ad428001d6e3a0ce30fa18ef574b4933 /lib/compiler/src/beam_ssa_pre_codegen.erl
parentdb8a1822079b309075dd5be9fa1cb2019da2c61d (diff)
downloadotp-6ae9975689858d0e0c9af0a36869c012bb3762c0.tar.gz
otp-6ae9975689858d0e0c9af0a36869c012bb3762c0.tar.bz2
otp-6ae9975689858d0e0c9af0a36869c012bb3762c0.zip
compiler: Fix awkward match context substitution
This worked out by accident since codegen never actually looks at the arguments for 'succeeded'; it just assumes that they reference the preceding instruction.
Diffstat (limited to 'lib/compiler/src/beam_ssa_pre_codegen.erl')
-rw-r--r--lib/compiler/src/beam_ssa_pre_codegen.erl4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_ssa_pre_codegen.erl b/lib/compiler/src/beam_ssa_pre_codegen.erl
index 9847b87b18..61b2155e39 100644
--- a/lib/compiler/src/beam_ssa_pre_codegen.erl
+++ b/lib/compiler/src/beam_ssa_pre_codegen.erl
@@ -603,6 +603,10 @@ bs_instrs([{L,#b_blk{is=Is0}=Blk}|Bs], CtxChain, Acc0) ->
bs_instrs([], _, Acc) ->
reverse(Acc).
+bs_instrs_is([#b_set{op=succeeded}=I|Is], CtxChain, Acc) ->
+ %% This instruction refers to a specific operation, so we must not
+ %% substitute the context argument.
+ bs_instrs_is(Is, CtxChain, [I | Acc]);
bs_instrs_is([#b_set{op=Op,args=Args0}=I0|Is], CtxChain, Acc) ->
Args = [bs_subst_ctx(A, CtxChain) || A <- Args0],
I1 = I0#b_set{args=Args},