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

Markus Böck llvmlistbot at llvm.org
Sun Jan 25 07:07:30 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
----------------
zero9178 wrote:

As far as semantics are concerned, I suppose loop peeling an infinite loop should at the very least keep the infinite loop? I.e. the first loop should remain infinite. I don't think the poison implements this (will lead to UB in LLVM lowering at least). 

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


More information about the Mlir-commits mailing list