[PATCH] D21720: Unroll for uncountable loops

Michael Zolotukhin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 10 12:14:52 PST 2017


mzolotukhin added a comment.

> Uncountable loops where previous value is reused (save one+ instruction for each value)

What do you mean by uncountable? How is it different from a loop with unknown trip count?
What is a previous value? Is it a value from a previous iteration? If that's the case, any induction variable satisfies that condition.

> No. All cases are about uncountable loops.

What's the difference between these two cases? I've gotten totally confused now.

> We can skip this and do like in my initial patch (just run a function that return unroll count if it is profitable to unroll). That way cases 2 and 3 are skipped. I change the patch to call `analyzeLoopUnrollCost' to make more general.

What is the case 3?

> The patch do not introduce a new threshold. If we enable unroll for all uncountable loops it will result in dramatic code size increase (for most cases without performance value).

Exactly. And unroll of any loop that has at least one IV will save at least one instruction, because we'll have a phi for the IV and we can fold this phi in between unrolled iterations. So, my point was that "saving one instruction" should not be enough to unroll a loop.


Repository:
  rL LLVM

https://reviews.llvm.org/D21720





More information about the llvm-commits mailing list