File 2703-beam_ssa_dead-Simplify-the-comb_get_sw-functions.patch of Package erlang

From a923654021aaa746773848833cbba6e9ac698b23 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Sat, 1 Feb 2020 08:02:03 +0100
Subject: [PATCH 03/13] beam_ssa_dead: Simplify the comb_get_sw() functions

Combine the comb_get_sw/2 and comb_get_sw/3 functions. There is
no need for a Safe argument because comb_get_sw() never calls
itself recursively.
---
 lib/compiler/src/beam_ssa_dead.erl | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/lib/compiler/src/beam_ssa_dead.erl b/lib/compiler/src/beam_ssa_dead.erl
index 697aeb23fb..021b773419 100644
--- a/lib/compiler/src/beam_ssa_dead.erl
+++ b/lib/compiler/src/beam_ssa_dead.erl
@@ -961,17 +961,14 @@ combine_eqs_1([L|Ls], #st{bs=Blocks0}=St0) ->
     end;
 combine_eqs_1([], St) -> St.
 
-comb_get_sw(L, Blocks) ->
-    comb_get_sw(L, true, Blocks).
-
-comb_get_sw(L, Safe0, #st{bs=Blocks,skippable=Skippable}) ->
+comb_get_sw(L, #st{bs=Blocks,skippable=Skippable}) ->
     #b_blk{is=Is,last=Last} = map_get(L, Blocks),
-    Safe1 = Safe0 andalso is_map_key(L, Skippable),
+    Safe0 = is_map_key(L, Skippable),
     case Last of
         #b_ret{} ->
             none;
         #b_br{bool=#b_var{}=Bool,succ=Succ,fail=Fail} ->
-            case comb_is(Is, Bool, Safe1) of
+            case comb_is(Is, Bool, Safe0) of
                 {none,_} ->
                     none;
                 {#b_set{op={bif,'=:='},args=[#b_var{}=Arg,#b_literal{}=Lit]},Safe} ->
@@ -982,7 +979,7 @@ comb_get_sw(L, Safe0, #st{bs=Blocks,skippable=Skippable}) ->
         #b_br{} ->
             none;
         #b_switch{arg=#b_var{}=Arg,fail=Fail,list=List} ->
-            {none,Safe} = comb_is(Is, none, Safe1),
+            {none,Safe} = comb_is(Is, none, Safe0),
             {Safe,Arg,L,Fail,List}
     end.
 
-- 
2.16.4

openSUSE Build Service is sponsored by