[all-commits] [llvm/llvm-project] c1730f: [mlir][SCF] Do not verify step size of `scf.for` (...

Matthias Springer via All-commits all-commits at lists.llvm.org
Mon Jan 15 08:47:06 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c1730f42219365f5105148870422592c25083104
      https://github.com/llvm/llvm-project/commit/c1730f42219365f5105148870422592c25083104
  Author: Matthias Springer <me at m-sp.org>
  Date:   2024-01-15 (Mon, 15 Jan 2024)

  Changed paths:
    M mlir/lib/Dialect/SCF/IR/SCF.cpp
    M mlir/test/Dialect/SCF/for-loop-peeling.mlir
    M mlir/test/Dialect/SCF/invalid.mlir

  Log Message:
  -----------
  [mlir][SCF] Do not verify step size of `scf.for` (#78141)

An op verifier should verify only local properties. This commit removes
the verification of `scf.for` step sizes. (Verifiers can check
attributes but should not follow SSA values.) This verification could
reject IR that is actually valid, e.g.:

```mlir
scf.if %always_false {
  // Branch is never entered.
  scf.for ... step %c0 { ... }
}
```

This commit fixes `for-loop-peeling.mlir` when running with
`MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS`:
```
within split at llvm-project/mlir/test/Dialect/SCF/for-loop-peeling.mlir:293 offset :9:3: note: see current operation:
"scf.for"(%0, %3, %2) ({
^bb0(%arg1: index):
  %4 = "arith.index_cast"(%arg1) : (index) -> i64
  "memref.store"(%4, %arg0) : (i64, memref<i64>) -> ()
  "scf.yield"() : () -> ()
}) {__peeled_loop__} : (index, index, index) -> ()
LLVM ERROR: IR failed to verify after folding
```

Note: `%2` is `arith.constant 0 : index`.




More information about the All-commits mailing list