[PATCH] D21720: Unroll for uncountable loops

Evgeny Stupachenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 9 15:00:52 PST 2017


evstupac added a comment.

> My biggest concern about this patch is that it doesn't solve the problem in a general way, but instead only catches two cases: s ^= 1 and s = -s.

Why PhiCycle is not general? That could be InstCycle instead (for i&3, i&7, i%N,....).
"i%2", "i&1" are convertible to "s^=1".

> IMHO, a general approach here would be to teach unroller (or maybe SCEV) to analyze N sequential iterations. E.g. for the xor case and for 2 sequential iterations starting at the i-th iteration, we'd get something like  S_i_plus_2 = S_i_plus_1 ^ 1 = (S_i ^ 1) ^ 1 = S_i.

Current approach do this, but starting from 0 iteration (taking in account that some instruction are cycle).

Suppose we skip this, what about:

1. Uncountable loops where previous value is reused (save one+ instruction for each value)?
2. Uncountable loops, that counts smth?


Repository:
  rL LLVM

https://reviews.llvm.org/D21720





More information about the llvm-commits mailing list