[PATCH] D43876: [LoopUnroll] Peel off iterations if it makes conditions true/false.

Jun Bum Lim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 7 14:31:31 PST 2018


junbuml added a comment.

> Great! Is there any code/examples you could share that would benefit?

Hopefully, below C code should show the case I'm pursuing. In this loop, we know that the condition is false only in the last one iteration.

void test (int* p, int* p2, int* p3, int v, int L) {

  unsigned int M = *p;
  int k;
  for (k = 1; k <= M; k++) {
    p2[k] = v;
    if (k < M) {
        p3[k] = v;
    }
  }

}


https://reviews.llvm.org/D43876





More information about the llvm-commits mailing list