[llvm] [LLVM][SCEV] udiv (mul nuw a, vscale), (mul nuw b, vscale) -> udiv a, b (PR #157836)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 1 04:25:06 PDT 2025


================
@@ -192,6 +193,10 @@ struct SCEVBinaryExpr_match {
   SCEVBinaryExpr_match(Op0_t Op0, Op1_t Op1) : Op0(Op0), Op1(Op1) {}
 
   bool match(const SCEV *S) const {
+    if (auto WrappingS = dyn_cast<SCEVNAryExpr>(S))
+      if (WrappingS->getNoWrapFlags(WrapFlags) != WrapFlags)
+        return false;
----------------
paulwalker-arm wrote:

Not all users are `SCEVNAryExpr`. Specifically `SCEVUDivExpr` uses this class, but does not inherit from `SCEVNAryExpr`.

https://github.com/llvm/llvm-project/pull/157836


More information about the llvm-commits mailing list