[PATCH] D25364: [LCSSA] Use linear algorithm for isRecursivelyLCSSAForm

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 7 14:23:24 PDT 2016


reames added a comment.

In https://reviews.llvm.org/D25364#564603, @mzolotukhin wrote:

> 2. If it's equivalent to the original, why do we need to be recursive at all? We can go through all blocks of the given loop but for each block find the innermost loop containing it and check if the value isn't used outside of it. What do you think?


I really like this framing.  Rather than asking whether each sub-loop is in LCSSA, we would essentially ask whether each BB is in LCSSA w.r.t. it's inner most containing loop.  Because we know all of the blocks within a sub-loop are also contained within an outer loop, this gives us the transitive property we need.

However, it does look like we don't currently verify the contains relation for sub-loops.  This may be covered by the off by default LoopInfo.verify(), but it's not directly enforced.   Not sure we need to block this patch on that fact, but the lack of verification makes me a bit nervous.


https://reviews.llvm.org/D25364





More information about the llvm-commits mailing list