File 1433-compiler-Remove-unreachable-code-in-alias-pass.patch of Package erlang

From c178c488ba6841b88c3a0c5a80f04d7c57a90263 Mon Sep 17 00:00:00 2001
From: Frej Drejhammar <frej.drejhammar@gmail.com>
Date: Thu, 2 May 2024 10:07:15 +0200
Subject: [PATCH 3/4] compiler: Remove unreachable code in alias pass

An `update_record` instruction will always have an `arg_types`
annotation as it will either be preceded by a guard test which allows
the type pass to deduce the types, or else, when the guard is missing,
the types are known, ie there is an annotation present.
---
 lib/compiler/src/beam_ssa_alias.erl | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/lib/compiler/src/beam_ssa_alias.erl b/lib/compiler/src/beam_ssa_alias.erl
index 45cafa1051..1789b99da8 100644
--- a/lib/compiler/src/beam_ssa_alias.erl
+++ b/lib/compiler/src/beam_ssa_alias.erl
@@ -1299,17 +1299,11 @@ eru_blocks([], Cnt, Acc) ->
 
 eru_is([#b_set{op=update_record,
                args=[_Hint,#b_literal{val=Size},Src|Updates]=Args,
-               anno=Anno0}=I0|Rest], First, Acc) ->
-    ArgTypes0 = maps:get(arg_types, Anno0, #{}),
+               anno=#{arg_types:=ArgTypes0}=Anno0}=I0|Rest], First, Acc) ->
     TupleType = maps:get(2, ArgTypes0, any),
     {Extracts,ExtraArgs,Next,ArgTypes} =
         eru_args(Updates, First, Src, Size, TupleType, ArgTypes0),
-    Anno = if map_size(ArgTypes) =:= 0 ->
-                   Anno0;
-              true ->
-                   Anno0#{arg_types=>ArgTypes}
-           end,
-    I = I0#b_set{args=Args++ExtraArgs,anno=Anno},
+    I = I0#b_set{args=Args++ExtraArgs,anno=Anno0#{arg_types=>ArgTypes}},
     eru_is(Rest, Next, [I|Extracts]++Acc);
 eru_is([I|Rest], First, Acc) ->
     eru_is(Rest, First, [I|Acc]);
-- 
2.35.3

openSUSE Build Service is sponsored by