[PATCH] D147117: [SCEV] When computing trip count, only zext if necessary

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 29 11:39:22 PDT 2023


reames added a comment.

Two levels of comments here.

First, you can probably use willNotOverflow(Opcode, LHS, RHS) here instead.

Second, I think you're solving the wrong problem with this patch.  If "1 + zext((6 * %N) - 1)" does not simplify to "zext((6 * %N))" when truncating the constant and folding the constant produces the same answer, that seems like a SCEV folding bug, and is probably the more general fix.  This would require the same basic proof, but inside getAddExpr.  Oddly, we don't seem to have either the zext or sext case there already.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147117



More information about the llvm-commits mailing list