File 5232-beam_ssa_opt-Eliminate-redundant-throw-and-try-catch.patch of Package erlang

From 33f12e04149f7de07439cda00d8766b2db8d919f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Fri, 25 Feb 2022 13:39:10 +0100
Subject: [PATCH 2/2] beam_ssa_opt: Eliminate redundant throw() and try/catch

---
 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 5f14d4005b..da9ebc0118 100644
--- a/lib/compiler/src/beam_ssa_opt.erl
+++ b/lib/compiler/src/beam_ssa_opt.erl
@@ -2507,13 +2507,12 @@ is_on_stack(From, Var, Blocks) ->
 is_on_stack([L|Ls], Var, Blocks, WillGC0) ->
     #b_blk{is=Is} = Blk = map_get(L, Blocks),
     GC0 = map_get(L, WillGC0),
-    try is_on_stack_is(Is, Var, GC0) of
+    case is_on_stack_is(Is, Var, GC0) of
+        {done,GC} ->
+            GC;
         GC ->
             WillGC = gc_update_successors(Blk, GC, WillGC0),
             is_on_stack(Ls, Var, Blocks, WillGC)
-    catch
-        throw:{done,GC} ->
-            GC
     end;
 is_on_stack([], _Var, _, _) -> false.
 
@@ -2522,7 +2521,7 @@ is_on_stack_is([#b_set{op=get_tuple_element}|Is], Var, GC) ->
 is_on_stack_is([I|Is], Var, GC0) ->
     case GC0 andalso member(Var, beam_ssa:used(I)) of
         true ->
-            throw({done,GC0});
+            {done,GC0};
         false ->
             GC = GC0 orelse beam_ssa:clobbers_xregs(I),
             is_on_stack_is(Is, Var, GC)
-- 
2.34.1

openSUSE Build Service is sponsored by