File 4611-beam_ssa_opt-Reuse-predecessor-calculation.patch of Package erlang
From 6687a76c3a96eee46a6e067f7ebec8f31072afd3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Fri, 25 Feb 2022 08:59:21 +0100
Subject: [PATCH 1/2] beam_ssa_opt: Reuse predecessor calculation
---
lib/compiler/src/beam_ssa_opt.erl | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/lib/compiler/src/beam_ssa_opt.erl b/lib/compiler/src/beam_ssa_opt.erl
index cf2a26eea7..5f14d4005b 100644
--- a/lib/compiler/src/beam_ssa_opt.erl
+++ b/lib/compiler/src/beam_ssa_opt.erl
@@ -2325,7 +2325,7 @@ do_ssa_opt_sink(Defs, #opt_st{ssa=Linear}=St) ->
%% It is not safe to move get_tuple_element instructions to blocks
%% that begin with certain instructions. It is also unsafe to move
%% the instructions into any part of a receive.
- Unsuitable = unsuitable(Linear, Blocks0),
+ Unsuitable = unsuitable(Linear, Blocks0, Preds),
%% Calculate new positions for get_tuple_element instructions. The new
%% position is a block that dominates all uses of the variable.
@@ -2538,12 +2538,11 @@ gc_update_successors(Blk, GC, WillGC) ->
end
end, WillGC, beam_ssa:successors(Blk)).
-%% unsuitable(Linear, Blocks) -> Unsuitable.
-%% Return an ordset of block labels for the blocks that are not
+%% unsuitable(Linear, Blocks, Predecessors) -> Unsuitable.
+%% Return an gbset of block labels for the blocks that are not
%% suitable for sinking of get_tuple_element instructions.
-unsuitable(Linear, Blocks) ->
- Predecessors = beam_ssa:predecessors(Blocks),
+unsuitable(Linear, Blocks, Predecessors) ->
Unsuitable0 = unsuitable_1(Linear),
Unsuitable1 = unsuitable_recv(Linear, Blocks, Predecessors),
gb_sets:from_list(Unsuitable0 ++ Unsuitable1).
--
2.34.1