[Mlir-commits] [mlir] [mlir][affine] fix the issue of ceildiv-mul-ceildiv form expression n… (PR #111254)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun Oct 6 23:16:28 PDT 2024


================
@@ -406,12 +419,25 @@ static bool isDivisibleBySymbol(AffineExpr expr, unsigned symbolPos,
     AffineBinaryOpExpr binaryExpr = cast<AffineBinaryOpExpr>(expr);
     if (opKind != expr.getKind())
       return false;
-    return isDivisibleBySymbol(binaryExpr.getLHS(), symbolPos, expr.getKind());
+    if (llvm::any_of(visitedExprs, [](auto expr) {
+          return expr.getKind() == AffineExprKind::Mul;
+        }))
+      return false;
+    return isDivisibleBySymbolImpl(binaryExpr.getLHS(), symbolPos,
+                                   expr.getKind(), visitedExprs, depth + 1);
----------------
lipracer wrote:

flag can't be used, If this expression`(s0 * 2) + s0 ceildiv 2)`,I need to reset the flag after visited lhs `add`,Do you think this behavior is easy to understand?

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


More information about the Mlir-commits mailing list