[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 11:57:19 PDT 2019


fhahn added a comment.

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

> I'm not sure how you never hit this issue before.  I mean, I can see from the testcase that the compare for the outer loop's branch can end up in the inner loop... but why is it not *always* in the inner loop?  What criteria are we using to sink it in some cases?  Should we be sinking in all cases?


Thanks for taking a look! I was surprised as well that this only pops up now. When splitting off the latch, we split at the IV increment instruction. So the IV increment instruction + all instructions after it will end up in the new latch block. I think usually for rotated loops, the incremented IV is used in the exit condition and that is why it only came up now by fuzzing I guess.

I supposes we could instead make sure we split at whatever comes first, IV increment or exit condition. We should probably also make sure we only move the IV increment and exit condition to the new latch. That should probably also be simpler than creating LCSSA phis in those cases. What do you think?


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