[PATCH] D75233: [LoopTerminology] LCSSA Form
Stefanos Baziotis via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 29 18:12:06 PDT 2020
baziotis added a comment.
In D75233#1948305 <https://reviews.llvm.org/D75233#1948305>, @Meinersbur wrote:
> In D75233#1944176 <https://reviews.llvm.org/D75233#1944176>, @baziotis wrote:
>
> > Yes. Could you explain the part about dominator nodes ? I understand how dominators help in the identification
> > of loops and how dominance frontiers help in the placement of normal PHI nodes (i.e. when 2 or more paths converge). But I don't see how dominators
> > help with the placement of LCSSA phi nodes.
>
>
> It is simple if the loop has just a single exit, but much more involved with multiple exits. Example CFG:
>
> Header:
> %val = ...
>
> Header->{Latch1,Latch2,Latch3}->Header
>
> Header->Latch1->Exit1
> Header->Latch2->Exit2
> Header->Latch3->Exit3
>
> Exit->Successor1
>
> Successor1->SharedSucc
> Exit2->SharedSucc
>
> SharedSucc->CommonSucc
> Exit3->CommonSucc
>
> CommonSucc:
> use(%val)
>
>
> Header dominates all other BBs in this example, hence without LCSSA, this is well-formed. However, with LCSSA we have to insert phis into Exit1,Exit2,Exit3 such that the end result has to look like:
>
> Exit1:
> %lcssa1 = phi [%val, %Latch1]
>
> Exit2:
> %lcssa2 = phi [%val, %Latch2]
>
> Exit3:
> %lcssa3 = phi [%val, %Latch3]
>
> SharedSucc:
> %sharedval = phi [%lcssa1 , %Exit1], [%lcssa2, %Exit2]
>
> CommonSucc:
> %commonval = phi [%lcssa3 , %Exit3], [%sharedval , %SharedSucc]
> use(%commonval)
>
>
> For computing %sharedval and %commonval, DominanceFrontier is needed again, hence LCSSA is not less complicated that SSA itself.
Ok, I get it now, thanks! So with multiple exits one has to compute dominator info again.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75233/new/
https://reviews.llvm.org/D75233
More information about the llvm-commits
mailing list