Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
4432-beam_ssa_type-Avoid-redundant-normalizatio...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 4432-beam_ssa_type-Avoid-redundant-normalization-calls.patch of Package erlang
From a6a458523b709b613a6498ef34799f64d5c66954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org> Date: Tue, 7 Sep 2021 06:55:33 +0200 Subject: [PATCH 2/2] beam_ssa_type: Avoid redundant normalization calls Avoid calls to `beam_ssa:normalize/1` when we know that nothing will happen. --- lib/compiler/src/beam_ssa_type.erl | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/lib/compiler/src/beam_ssa_type.erl b/lib/compiler/src/beam_ssa_type.erl index d3bb6df878..63dfa64199 100644 --- a/lib/compiler/src/beam_ssa_type.erl +++ b/lib/compiler/src/beam_ssa_type.erl @@ -267,7 +267,7 @@ sig_is([#b_set{op=call, dst=Dst}=I0 | Is], Ts0, Ds0, Ls, Fdb, Sub, State0) -> Args = simplify_args(Args0, Ts0, Sub), - I1 = beam_ssa:normalize(I0#b_set{args=Args}), + I1 = I0#b_set{args=Args}, [_ | CallArgs] = Args, {I, State} = sig_local_call(I1, Callee, CallArgs, Ts0, Fdb, State0), @@ -280,7 +280,7 @@ sig_is([#b_set{op=call, dst=Dst}=I0 | Is], Ts0, Ds0, Ls, Fdb, Sub, State) -> Args = simplify_args(Args0, Ts0, Sub), - I1 = beam_ssa:normalize(I0#b_set{args=Args}), + I1 = I0#b_set{args=Args}, [Fun | _] = Args, I = case normalized_type(Fun, Ts0) of @@ -295,7 +295,7 @@ sig_is([#b_set{op=MakeFun,args=Args0,dst=Dst}=I0|Is], sig_is([#b_set{op=make_fun,args=Args0,dst=Dst}=I0|Is], Ts0, Ds0, Ls, Fdb, Sub0, State0) -> Args = simplify_args(Args0, Ts0, Sub0), - I1 = beam_ssa:normalize(I0#b_set{args=Args}), + I1 = I0#b_set{args=Args}, {I, State} = sig_make_fun(I1, Ts0, Fdb, State0), @@ -521,7 +521,7 @@ opt_is([#b_set{op=call, dst=Dst}=I0 | Is], Ts0, Ds0, Ls, Fdb0, Sub, Meta, Acc) -> Args = simplify_args(Args0, Ts0, Sub), - I1 = beam_ssa:normalize(I0#b_set{args=Args}), + I1 = I0#b_set{args=Args}, [_ | CallArgs] = Args, {I, Fdb} = opt_local_call(I1, Callee, CallArgs, Dst, Ts0, Fdb0, Meta), @@ -534,7 +534,7 @@ opt_is([#b_set{op=call, dst=Dst}=I0 | Is], Ts0, Ds0, Ls, Fdb, Sub, Meta, Acc) -> Args = simplify_args(Args0, Ts0, Sub), - I1 = beam_ssa:normalize(I0#b_set{args=Args}), + I1 = I0#b_set{args=Args}, [Fun | _] = Args, I = case normalized_type(Fun, Ts0) of @@ -551,7 +551,7 @@ opt_is([#b_set{op=MakeFun,args=Args0,dst=Dst}=I0|Is], opt_is([#b_set{op=make_fun,args=Args0,dst=Dst}=I0|Is], Ts0, Ds0, Ls, Fdb0, Sub0, Meta, Acc) -> Args = simplify_args(Args0, Ts0, Sub0), - I1 = beam_ssa:normalize(I0#b_set{args=Args}), + I1 = I0#b_set{args=Args}, {I, Fdb} = opt_make_fun(I1, Ts0, Fdb0, Meta), @@ -712,9 +712,9 @@ simplify(#b_set{op=phi,dst=Dst,args=Args0}=I0, Ts0, Ds0, Ls, Sub) -> Ds = Ds0#{ Dst => I }, {I, Ts, Ds} end; -simplify(#b_set{op={succeeded,Kind},args=[Arg],dst=Dst}=I0, +simplify(#b_set{op={succeeded,Kind},args=[Arg],dst=Dst}=I, Ts0, Ds0, _Ls, Sub) -> - Type = case will_succeed(I0, Ts0, Ds0, Sub) of + Type = case will_succeed(I, Ts0, Ds0, Sub) of yes -> beam_types:make_atom(true); no -> beam_types:make_atom(false); maybe -> beam_types:make_boolean() @@ -735,14 +735,13 @@ simplify(#b_set{op={succeeded,Kind},args=[Arg],dst=Dst}=I0, %% Note that we never simplify args; this instruction is specific %% to the operation being checked, and simplifying could break that %% connection. - I = beam_ssa:normalize(I0), Ts = Ts0#{ Dst => Type }, Ds = Ds0#{ Dst => I }, {I, Ts, Ds} end; simplify(#b_set{op=bs_match,dst=Dst,args=Args0}=I0, Ts0, Ds0, _Ls, Sub) -> Args = simplify_args(Args0, Ts0, Sub), - I1 = beam_ssa:normalize(I0#b_set{args=Args}), + I1 = I0#b_set{args=Args}, I2 = case {Args0,Args} of {[_,_,_,#b_var{},_],[Type,Val,Flags,#b_literal{val=all},Unit]} -> %% The size `all` is used for the size of the final binary @@ -754,8 +753,7 @@ simplify(#b_set{op=bs_match,dst=Dst,args=Args0}=I0, Ts0, Ds0, _Ls, Sub) -> end, %% We KNOW that simplify/2 will return a #b_set{} record when called with %% a bs_match instruction. - #b_set{} = I3 = simplify(I2, Ts0), - I = beam_ssa:normalize(I3), + #b_set{} = I = simplify(I2, Ts0), Ts = update_types(I, Ts0, Ds0), Ds = Ds0#{ Dst => I }, {I, Ts, Ds}; @@ -763,8 +761,7 @@ simplify(#b_set{dst=Dst,args=Args0}=I0, Ts0, Ds0, _Ls, Sub) -> Args = simplify_args(Args0, Ts0, Sub), I1 = beam_ssa:normalize(I0#b_set{args=Args}), case simplify(I1, Ts0) of - #b_set{}=I2 -> - I = beam_ssa:normalize(I2), + #b_set{}=I -> Ts = update_types(I, Ts0, Ds0), Ds = Ds0#{ Dst => I }, {I, Ts, Ds}; -- 2.31.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor