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

Krzysztof Drewniak llvmlistbot at llvm.org
Thu Jan 22 07:44:56 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
----------------
krzysz00 wrote:

So given that we've defined acf.for to Noe allow infinite loops, having the loop peeler generate poison on such loops is probably reasonable behavior from a loop peeling pass 

Whether that restriction on for loops makes sense, I'm less sure about 

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


More information about the Mlir-commits mailing list