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

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 6 15:45:32 PDT 2016


reames added a comment.

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.


https://reviews.llvm.org/D24280





More information about the llvm-commits mailing list