[PATCH] D21720: Unroll for uncountable loops

Evgeny Stupachenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 10 09:55:19 PST 2017


evstupac added a comment.

> Case 1 sounds good, but maybe our existing heuristic should get it? I don't understand what you mean in case 2.

Actually case 1 is the most simple and profitable. Maybe we shall start with it only?
Regarding case 2:

It covers loops which counts how long some condition is true. For example (how many elements in the list):
while (curr) {

  len++;
  curr = curr->next;

}

After unroll by 2:

while(curr) {

  curr1 = curr->next;
  if (!curr1) goto exit1;
  curr = curr1->next;
  len+=2;

}
exit1:
len++;
loop exit:


Repository:
  rL LLVM

https://reviews.llvm.org/D21720





More information about the llvm-commits mailing list