[PATCH] D67076: [LoopInterchange] Make sure we create PHI nodes for uses in split off latch.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 14:45:09 PDT 2019


fhahn planned changes to this revision.
fhahn added a comment.

In D67076#1659683 <https://reviews.llvm.org/D67076#1659683>, @efriedma wrote:

> Is there a potential correctness issue here, if some operation that isn't the exit condition or the IV increment somehow ends up in the new latch?


I think the current restrictions avoid any problems. We only allow zext, trunc and cmp instructions between the IV increment and the branch inst. If the final value is used outside the loop, that should be fine. A problem could be occur if any of the moved instructions is part of a reduction. I tried and it seems like we do not recognize reductions with trunc/zext chains at the moment, so we should be covered there. But I guess it would be good to make sure the instructions beside the IV increment are only used in the check for the exit condition.

> It seems more straightforward to ensure the new latch contains exactly the instructions you expect, rather than creating an LCSSA PHI for a value you've proved is loop-invariant.

Thanks, I'll update the patch


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67076





More information about the llvm-commits mailing list