[PATCH] D89739: [LCSSA] Doc for special treatment of PHIs

Stefanos Baziotis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 26 12:50:26 PDT 2020


baziotis added inline comments.


================
Comment at: llvm/docs/LoopTerminology.rst:175
 in LCSSA. To achieve the latter, single entry PHI nodes are inserted
-at the end of the loops for all values that are live
-across the loop boundary [#lcssa-construction]_.
-In particular, consider the following loop:
+at the end of the loop (specifically at its exit blocks) for all values
+that are live across the loop boundary [#lcssa-construction]_
----------------
Meinersbur wrote:
> > specifically at its exit blocks
> 
> This wording is somewhat imprecise (where is 'at'? an exit block is after the loop), Suggestion: "PHI nodes with just a single incoming value/block are added into each of the loop's exit blocks ..."
Ok, let's remove "at the end of the loop". FWIW, I tried to avoid details here because an exit block can have multiple predecessors and some of them might be outside the loop. And this is still the start of the explanation.


================
Comment at: llvm/docs/LoopTerminology.rst:223-225
+corresponding predecessor block to the current block". To that end,
+formally the use truly happens at the boundary of the loop and for
+the purposes of LCSSA, we consider it happens inside it.
----------------
Meinersbur wrote:
> The edge is clearly outside the loop, since when the control-flow uses it, it will not be looping anymore.
> 
> Treating the exiting block as user moves the use into the loop. For the purpose of LCSSA, this is exactly be what we want, since ensures all values that are defined in a loop are also only used in the loop. Could you move that part to the following paragraph to separate its from the strict formalism?
Hmm, it seems to me that this will throw people off. It is easy to think "if the edge is considered outside how do you consider the use inside?" Let's assume that we answer that with "it works for LCSSA's purpose". But then "this is used all over LLVM, not just LCSSA". The whole reasoning seems flawed and like a hack. I'll retry anyway.

(Note that this part of the paragraph tries to answer what the start of the paragraph questions; if I move it, I'll have to rewrite all of it, which I'll do).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89739/new/

https://reviews.llvm.org/D89739



More information about the llvm-commits mailing list