[PATCH] D63618: Exploit a zero LoopExit count to eliminate loop exits

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 23 12:44:03 PDT 2019


sanjoy added a comment.

In D63618#1554829 <https://reviews.llvm.org/D63618#1554829>, @reames wrote:

> In D63618#1554009 <https://reviews.llvm.org/D63618#1554009>, @sanjoy wrote:
>
> > Agreed.  I'm mainly curious about the specific test changes in this patch, not with the general idea.
>
>
> I dug into this a bit, and it turns out the Nikita is partly right.  What's going on is that when we visit a cast (for the widening analysis), we always skip it's users (for the simplifying transforms).  This doesn't seem to really make any sense, and removing it doesn't appear to break any test.  Anyone have any idea why this might be the case?  I'm really tempted to just remove the continue.


That sounds reasonable, but here are a couple of things you might want to check before making that change (I assume you're talking about removing this like: https://github.com/llvm-mirror/llvm/blob/5fae5e00b26a33fcdc2c350ddbe5b0bc36b67ea6/lib/Transforms/Utils/SimplifyIndVar.cpp#L919)):

- Maybe we're skipping `sext`/`zext` since we're going to create a wider IV and revisit the widened users anyway (in `IndVarSimplify::simplifyAndExtend`).
- Maybe we're skipping `trunc` because most likely the `trunc` was inserted by a previous round of `Widener.createWideIV` and we do not want to re-do the work of simplifying the narrow IV.
- Maybe `SimplifyIndvar::simplifyUsers` expects all of the IV users it is asked to simplify to have the same bitwidth.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63618/new/

https://reviews.llvm.org/D63618





More information about the llvm-commits mailing list