aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-01-06 10:04:47 +0100
committerBjörn Gustavsson <[email protected]>2018-01-11 12:00:07 +0100
commit9a3eba6a8f4e0e72294b386ddf4a7c60cc650e40 (patch)
tree4084a66faa555c6aa853d3a0e20f8e2e7310bd99 /lib
parent670ae523616961e4c4a2b3c230ec50a2438d477c (diff)
downloadotp-9a3eba6a8f4e0e72294b386ddf4a7c60cc650e40.tar.gz
otp-9a3eba6a8f4e0e72294b386ddf4a7c60cc650e40.tar.bz2
otp-9a3eba6a8f4e0e72294b386ddf4a7c60cc650e40.zip
sys_core_fold: Make it clear what part of Sub is used
Diffstat (limited to 'lib')
-rw-r--r--lib/compiler/src/sys_core_fold.erl10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/compiler/src/sys_core_fold.erl b/lib/compiler/src/sys_core_fold.erl
index f78a22518e..cc673dd137 100644
--- a/lib/compiler/src/sys_core_fold.erl
+++ b/lib/compiler/src/sys_core_fold.erl
@@ -2661,9 +2661,17 @@ opt_simple_let_1(#c_let{vars=Vs0,body=B0}=Let, Arg0, Ctxt, Sub0) ->
%% Optimise let and add new substitutions.
{Vs,Args,Sub1} = let_substs(Vs0, Arg0, Sub0),
BodySub = update_let_types(Vs, Args, Sub1),
+ Sub = Sub1#sub{v=[],s=cerl_sets:new()},
B = body(B0, Ctxt, BodySub),
Arg = core_lib:make_values(Args),
- opt_simple_let_2(Let, Vs, Arg, B, B0, Ctxt, Sub1).
+ opt_simple_let_2(Let, Vs, Arg, B, B0, Ctxt, Sub).
+
+
+%% opt_simple_let_2(Let0, Vs0, Arg0, Body, PrevBody, Ctxt, Sub) -> Core.
+%% Do final simplifications of the let.
+%%
+%% Note that the substitutions and scope in Sub have been cleared
+%% and should not be used.
opt_simple_let_2(Let0, Vs0, Arg0, Body, PrevBody, Ctxt, Sub) ->
case {Vs0,Arg0,Body} of