File 0269-Speed-up-compilation-of-huge-modules.patch of Package erlang

From 81bc659e4cf0f4842f28c1042a21122c0ff6a57b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Sun, 31 Jan 2021 08:17:25 +0100
Subject: [PATCH 1/2] Speed up compilation of huge modules

Reorder the compiler passes so that the beam_ssa_share passes
is run before the beam_ssa_bool and beam_ssa_recv passes.
For huge modules where the share optimization can be applied,
that can noticeably reduce the compile time.

For example, on my computer, this change reduced the compile
time for the String.Unicode module in the Elixir standard library
from almost 30 seconds down to less than 15 seconds.
---
 lib/compiler/src/compile.erl | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl
index 4fec417c6e..e6e0389cf9 100644
--- a/lib/compiler/src/compile.erl
+++ b/lib/compiler/src/compile.erl
@@ -851,7 +851,11 @@ kernel_passes() ->
      {iff,dssa,{listing,"ssa"}},
      {iff,ssalint,{pass,beam_ssa_lint}},
      {delay,
-      [{unless,no_bool_opt,{pass,beam_ssa_bool}},
+      [{unless,no_share_opt,{pass,beam_ssa_share}},
+       {iff,dssashare,{listing,"ssashare"}},
+       {unless,no_share_opt,{iff,ssalint,{pass,beam_ssa_lint}}},
+
+       {unless,no_bool_opt,{pass,beam_ssa_bool}},
        {iff,dbool,{listing,"bool"}},
        {unless,no_bool_opt,{iff,ssalint,{pass,beam_ssa_lint}}},
 
@@ -859,10 +863,6 @@ kernel_passes() ->
        {iff,dbool,{listing,"bool"}},
        {unless,no_bool_opt,{iff,ssalint,{pass,beam_ssa_lint}}},
 
-       {unless,no_share_opt,{pass,beam_ssa_share}},
-       {iff,dssashare,{listing,"ssashare"}},
-       {unless,no_share_opt,{iff,ssalint,{pass,beam_ssa_lint}}},
-
        {unless,no_bsm_opt,{pass,beam_ssa_bsm}},
        {iff,dssabsm,{listing,"ssabsm"}},
        {unless,no_bsm_opt,{iff,ssalint,{pass,beam_ssa_lint}}},
-- 
2.26.2

openSUSE Build Service is sponsored by