Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:25
erlang
2382-beam_ssa_opt-Re-run-try-optimization-after...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 2382-beam_ssa_opt-Re-run-try-optimization-after-merging-b.patch of Package erlang
From 22f05216801400f5b83ad2e0a7f553a2f724cb60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20H=C3=B6gberg?= <john@erlang.org> Date: Mon, 9 Jan 2023 10:03:33 +0100 Subject: [PATCH 2/2] beam_ssa_opt: Re-run try optimization after merging blocks --- lib/compiler/src/beam_ssa_opt.erl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/compiler/src/beam_ssa_opt.erl b/lib/compiler/src/beam_ssa_opt.erl index fecb5bebd5..9cb70f4498 100644 --- a/lib/compiler/src/beam_ssa_opt.erl +++ b/lib/compiler/src/beam_ssa_opt.erl @@ -291,6 +291,7 @@ epilogue_passes(Opts) -> ?PASS(ssa_opt_blockify), ?PASS(ssa_opt_redundant_br), ?PASS(ssa_opt_merge_blocks), + ?PASS(ssa_opt_try), ?PASS(ssa_opt_get_tuple_element), ?PASS(ssa_opt_tail_literals), ?PASS(ssa_opt_trim_unreachable), @@ -1566,7 +1567,14 @@ live_opt_is([], Live, Acc) -> %%% never throw. %%% -ssa_opt_try({#opt_st{ssa=Linear,cnt=Count0}=St, FuncDb}) -> +ssa_opt_try({#opt_st{ssa=SSA0,cnt=Count0}=St, FuncDb}) -> + {Count, SSA} = opt_try(SSA0, Count0), + {St#opt_st{ssa=SSA,cnt=Count}, FuncDb}. + +opt_try(Blocks, Count0) when is_map(Blocks) -> + {Count, Linear} = opt_try(beam_ssa:linearize(Blocks), Count0), + {Count, maps:from_list(Linear)}; +opt_try(Linear, Count0) when is_list(Linear) -> {Count, Shrunk} = shrink_try(Linear, Count0, []), Reduced = reduce_try(Shrunk, []), @@ -1574,7 +1582,7 @@ ssa_opt_try({#opt_st{ssa=Linear,cnt=Count0}=St, FuncDb}) -> EmptySet = sets:new([{version, 2}]), Trimmed = trim_try(Reduced, EmptySet, EmptySet, []), - {St#opt_st{ssa=Trimmed,cnt=Count}, FuncDb}. + {Count, Trimmed}. %% Moves all leading/trailing instructions that cannot fail out of try/catch %% expressions. For example, we can move the tuple constructions `{defg,Arg}` -- 2.35.3
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