[PATCH] D21237: LoopRotation: remove iterative calls to rotateLoops

Sebastian Pop via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 10 13:01:11 PDT 2016


sebpop added a comment.

In http://reviews.llvm.org/D21237#454988, @dberlin wrote:

> What's the reasoning/justification for the original vs the change?


As the code is written, the function rotateLoop only execute once.

  // Rotate if either the loop latch does *not* exit the loop, or if the loop
  // latch was just simplified.
  if (L->isLoopExiting(OrigLatch) && !SimplifiedLatch)
    return false;

Furthermore a testcase that contains more than 1 loop exit does not get rotated correctly: only the first condition gets rotated.

void foo (int *p, int a, int b) {

  while (a % b && b / a) {
    *p = a++;
    p++;
  }

}

We are working on fixing the rotation of this loop in a separate patch.


http://reviews.llvm.org/D21237





More information about the llvm-commits mailing list