[PATCH] D31488: [SimplifyIndvar] Replace the sdiv used by IV if we can prove both of its operands are non-negative

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 15:10:38 PDT 2017


sanjoy added a comment.

In https://reviews.llvm.org/D31488#714672, @etherzhhb wrote:

> In https://reviews.llvm.org/D31488#714492, @sanjoy wrote:
>
> > Comments inline.
> >
> > You can also do this same rewrite within SCEV.  That is, try to have `getSCEV(sdiv instruction)` return a `SCEVUDivExpr` if legal.
>
>
> This also sounds reasonable and I can also look at that after this.
>  Just a quick question: are we suppose to use getSCEVAtScope in getSCEV?


Not in general.  The SCEV expressions you return from `getSCEV` need to be context insensitive.

>>   However, given that `udiv` is more canonical, this patch is good too if it solves your problem.




Repository:
  rL LLVM

https://reviews.llvm.org/D31488





More information about the llvm-commits mailing list