[Mlir-commits] [mlir] [mlir][DialectUtils] Fix 0 step handling in `constantTripCount` (PR #177329)

Matthias Springer llvmlistbot at llvm.org
Thu Jan 22 02:04:14 PST 2026


================
@@ -357,9 +357,15 @@ func.func @regression(%arg0: memref<i64>, %arg1: index) {
 // -----
 
 // Regression test: Make sure that we do not crash.
-// The step is 0, the loop will be eliminated.
+
 // CHECK-LABEL: func @zero_step(
-//       CHECK-NOT:   scf.for
+//       CHECK:   %[[c0:.*]] = arith.constant 0
+//       CHECK:   %[[c1:.*]] = arith.constant 1
+//       CHECK:   %[[poison:.*]] = ub.poison
----------------
matthias-springer wrote:

The poison here is because loop peeling produces `affine.apply` with division by zero.

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


More information about the Mlir-commits mailing list