[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:39:42 PDT 2016


reames added a comment.

I would suggest framing this slightly differently.  If we know the IV is positive, we know that a sext and an zext must produce exactly the same result.  We should canonicalize on one of them in general (which I think is what your previous patches caused) and the widening code should produce the optimal result for either.  In fact, it looks like there's a NeverNegative flag on NarrowIVDefUse which already tries to do this.

I think the problem here is that we're failing to use this information in getWideRecurrence?

Note that I'm not an expert in this code and would really appreciate a second opinion.


https://reviews.llvm.org/D24280





More information about the llvm-commits mailing list