[PATCH] D142901: [InstSimplify] Simplify UREM and SREM left shifted operands

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 30 10:35:32 PST 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:997
+                         const SimplifyQuery &Q) {
+  // rem X << S1, X << S2
+  // if (S1 >= S2) -> 0; else -> X << S1
----------------
Maybe add a `TODO` for the more generalized case of `(rem (mul nsw/nuw X, C1), (mul nsw/nuw X, C2) if C1 % C2 == 0 -> 0` We seem to be missing it: https://godbolt.org/z/fzxb4sxb5


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142901



More information about the llvm-commits mailing list