Skip to content

Commit

Permalink
compiler: Stop alias analysis when erlang:exit/1 is called
Browse files Browse the repository at this point in the history
erlang:exit/1 will never return, so nothing that happens after the
call can influence the aliasing status of a variable.
  • Loading branch information
frej committed Aug 2, 2023
1 parent dbe6c53 commit 359d960
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/compiler/src/beam_ssa_alias.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,12 @@ aa_call(Dst, [#b_local{}=Callee|Args], Anno, SS0,
%% the status of any variables
{SS0, AAS0}
end;
aa_call(_Dst, [#b_remote{mod=#b_literal{val=erlang},
name=#b_literal{val=exit},
arity=1}|_], _Anno, SS, AAS) ->
%% The function will never return, so nothing that happens after
%% this can influence the aliasing status.
{SS, AAS};
aa_call(Dst, [_Callee|Args], _Anno, SS, AAS) ->
%% This is either a call to a fun or to an external function,
%% assume that all arguments and the result escape.
Expand Down

0 comments on commit 359d960

Please sign in to comment.