[PATCH] D46162: [PowerPC] Don't transform to CTR loop if the decrement branch instr. would end up in a different loop

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 27 19:15:22 PDT 2018


mkazantsev added inline comments.


================
Comment at: lib/Target/PowerPC/PPCCTRLoops.cpp:578
+    // end up messing up the value in the CTR.
+    if (LI->getLoopFor(*I) != L || !DT->dominates(L->getHeader(), *I))
+      continue;
----------------
nemanjai wrote:
> mkazantsev wrote:
> > By definition, loop header dominates all blocks of this loop. So once you've checked that `LI->getLoop(*I)` is `L`, it will automatically give you the second part of the check. I think you can assert that `DT->dominates(L->getHeader(), *I))` if the first part is true.
> Ah, OK. That makes sense. So clearly my condition isn't sufficient to address Eli's comment. If either you or Eli can suggest how I might modify this condition to also address irreducible loops completely nested in the outer loop, I would really appreciate it.
I don't think that SCEV will be able to calculate iteration count for a loop with irreducible control flow. Do you have a test when you really need to support it?


Repository:
  rL LLVM

https://reviews.llvm.org/D46162





More information about the llvm-commits mailing list