[PATCH] D21720: Unroll for uncountable loops

Michael Zolotukhin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 14 18:34:31 PST 2016


mzolotukhin added a comment.

>> What is the motivation of this change? How often do we see such loops?
>  Not each test looks like this, but there are couple where we switch states:
> 
> state = st[s^=1];
>  which becomes invariant with some other calculations after unroll.

I realize that it's possible to write such a test. My question was how frequent are such cases in real programs. Can you provide statistics from SPEC/llvm-testsuite that would justify the change?

>> If we do want to handle such cases (which I'm not convinced now), then we should do it in a general way. That is, the logic should be in instruction visitors, and we should automagically deduce that these instructions are free.
>  The same is valid for the code above where complete unroll simplify phi. Why phi is simplified here?

PHIs are present in every loop, in contrast to XORs.

> The other solution is to pass, unroll factor in addition to iteration number and move simplification there.
>  Do you think this is better?

I haven't put much thought to this yet, because I'm still not convinced in the need of this change. It's possible though that if we decide to go this way, we'll need to do some prep-work first to make the code look nice. The main part of simplification code is already there (with PHI-nodes getting an extra attention due to their special and very important nature).


Repository:
  rL LLVM

https://reviews.llvm.org/D21720





More information about the llvm-commits mailing list