[PATCH] D114018: [SCEV] Canonicalize X - urem X, Y patterns

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 16 11:35:55 PST 2021


reames added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:2604
 
+  // Canonicalize (-1 * urem X, Y) + X --> (Y * X/Y)
+  if (Ops.size() == 2) {
----------------
lebedev.ri wrote:
> What about the more general case of `(-1 * urem X, Y) + X + Z --> ((-1 * urem X, Y) + X) + Z --> (Y * X/Y) + Z` ?
The pattern matching for this gets hairy.  I think it's worthwhile to do (so that we can handle backedge taken count expressions in runtime unroll), but I'd strongly prefer to generalize in a separate commit with it's own review.  


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114018



More information about the llvm-commits mailing list