[llvm] r228265 - Implement new heuristic for complete loop unrolling.
Michael Zolotukhin
mzolotukhin at apple.com
Fri Feb 20 19:17:01 PST 2015
Hi Chandler,
I prepared a new version of the patch, do you mind taking a look at it?
To me it looks even simpler than the original implementation, and additionally can handle branches (I added two tests for that).
Thanks,
Michael
> On Feb 13, 2015, at 11:58 AM, Chandler Carruth <chandlerc at google.com> wrote:
>
>
> On Fri, Feb 13, 2015 at 11:52 AM, Michael Zolotukhin <mzolotukhin at apple.com <mailto:mzolotukhin at apple.com>> wrote:
> Thank you for the work and pointing out to the problems! It’s good that we found them early.
>
> I think that we would solve these issues if we do the following:
> 1. When looking for simplified instructions, visit each instruction only once. That’ll be achieved by visiting blocks in pre-order.
> 2. When looking for dead-instructions, also visit them only once - here we would need to visit blocks in reverse-order.
> 3. SCEV indeed might be too slow for this, but we actually only interested in expressions that become constants. That means, we need SCEV for expressions that either feed a load, or have constant Start and Step SCEV-expressions. We can scan all insns once and cache results for such potentially-constant instructions, other instructions don’t need SCEV-expression. So, we won’t need to talk to SCEV after this point.
> 4. As for using threshold for early-exit - that’s a really good idea, and it should integrate here naturally.
>
> What do you think about this? Am I missing something, or does it sound right?
>
> Generally yes, but I would start without trying to handle dead instructions, and following the sketch of how to build it I gave. I would then layer dead instructions on as a follow-up. There are several different approaches to handling dead instructions, and I think it will be useful to see how things look without handling them first.
>
> Note that the outline I gave naturally will skip dead *control flow*, because we can simplify the condition to a constant and only traverse one of the successors.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150220/a6cc865c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: complete-unroll.patch
Type: application/octet-stream
Size: 32298 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150220/a6cc865c/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150220/a6cc865c/attachment-0001.html>
More information about the llvm-commits
mailing list