[PATCH] D111896: [indvars] Canonicalize exit conditions to unsigned using range info

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 15 11:21:08 PDT 2021


reames added a comment.

In D111896#3067338 <https://reviews.llvm.org/D111896#3067338>, @nikic wrote:

> My main question here would be why we need this in IndVars. This doesn't really seem to be related to IV or loop based reasoning, but is a generic range based transform. Even InstCombine can handle this (based on known bits): https://godbolt.org/z/drGfM4K9o And as Roman mentioned on the other review, CVP could do this based on ranges as well.
>
> Now, if this case simply fell out of existing code (i.e. if the "visiting more users" approach worked) I'd understand, but it's not super clear to me why we need to go out of the way to handle this here. Is this addressing some kind of phase ordering issue?

Well, the motivation for doing this here is that the companion patch *is* inherently loop based.  It feels silly to leave cases on the floor just because we might get them elsewhere when we already have a need for a loop based transform in exactly this place.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111896



More information about the llvm-commits mailing list