Skip to content

Commit

Permalink
compiler alias analysis: Alternate function traversal order
Browse files Browse the repository at this point in the history
Sharing state information flows from callers to callees for function
arguments, and from callees to callers for results. Previously callers
were always analyzed before callees, but it turns out that the alias
analysis converges faster if the traversal order is alternated between
caller-callee and callee-caller.
  • Loading branch information
frej committed Jul 31, 2024
1 parent 76c0f32 commit 630b7ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/compiler/src/beam_ssa_alias.erl
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ aa_fixpoint(Funs, AAS=#aas{func_db=FuncDb}) ->
Order = aa_order(Funs, FuncDb),
?DP("Traversal order:~n ~s~n",
[string:join([fn(F) || F <- Order], ",\n ")]),
aa_fixpoint(Order, Order, AAS, 1).
aa_fixpoint(Order, reverse(Order), AAS, 1).

aa_fixpoint([F|Fs], Order,
AAS0=#aas{func_db=FuncDb,st_map=StMap,
Expand Down Expand Up @@ -388,7 +388,7 @@ aa_fixpoint([], Order, #aas{func_db=FuncDb,repeats=Repeats}=AAS, NoofIters) ->
{StMap, FuncDb};
NewOrder ->
?DP("**** Starting traversal ~p ****~n", [NoofIters + 1]),
aa_fixpoint(NewOrder, Order,
aa_fixpoint(NewOrder, reverse(Order),
AAS#aas{repeats=sets:new()}, NoofIters + 1)
end.

Expand Down

0 comments on commit 630b7ca

Please sign in to comment.