[Mlir-commits] [mlir] [MLIR][SCF] Define `-scf-rotate-while` pass (PR #99850)

Victor Perez llvmlistbot at llvm.org
Mon Jul 29 14:54:33 PDT 2024


================
@@ -20,7 +20,7 @@ func.func @wrap_while_loop_in_zero_trip_check(%bound : i32) -> i32 {
 // CHECK-SAME:      %[[BOUND:.*]]: i32) -> i32 {
 // CHECK-DAG:     %[[C0:.*]] = arith.constant 0 : i32
 // CHECK-DAG:     %[[C5:.*]] = arith.constant 5 : i32
-// CHECK-DAG:     %[[PRE_COND:.*]] = arith.cmpi slt, %[[C0]], %[[BOUND]] : i32
+// CHECK-DAG:     %[[PRE_COND:.*]] = arith.cmpi sgt, %[[BOUND]], %[[C0]] : i32
----------------
victor-eds wrote:

`c0 < bound iff bound > c0` works. If we were using `sge` instead, we'd end up with `bound >= c0`. This introduces the case in which `bound = c0`, which is not in the original `c0 < bound` precondition. The folding pattern is correct.

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


More information about the Mlir-commits mailing list