[PATCH] D24280: [IndVarSimplify] Prefer sext over zext when widening IV if it is non-negative and has a GEP user

Li Huang via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 7 16:58:31 PDT 2016


lihuang added a comment.

In https://reviews.llvm.org/D24280#535316, @reames wrote:

> Another way of framing the possible fix is to change:
>
>   // Our raison d'etre! Eliminate sign and zero extension.
>   if (IsSigned ? isa<SExtInst>(DU.NarrowUse) : isa<ZExtInst>(DU.NarrowUse))
>   
>
> To:
>
>   if ((DU.NeverNegative && (isa<SExtInst>(DU.NarrowUse) || isa<ZExtInst>(DU.NarrowUse))) ||
>      (IsSigned ? isa<SExtInst>(DU.NarrowUse) : isa<ZExtInst>(DU.NarrowUse)))
>   
>
> Obviously, clean up the code please. :)
>
> This handles the sext/zext cases, but not the GEP cases.  That still needs the getWideRecurrence parts.


This is the same logic as in https://reviews.llvm.org/D18867, but this is not enough, as you said, it doesn't work for the GEP cases.


https://reviews.llvm.org/D24280





More information about the llvm-commits mailing list