[Mlir-commits] [mlir] [mlir] fix a crash (PR #68519)

Matthias Springer llvmlistbot at llvm.org
Sun Oct 8 08:45:36 PDT 2023


matthias-springer wrote:

I have not looked at the fix in detail yet, just one comment: This bug looks like a case of "folding leads to invalid op". But we do not create an invalid op but already crash when trying to create it. Similar issues were discussed in the context of "poison semantics". You could have IR such as:

```mlir
scf.if %c {
  // The folder of affine.apply crashes due to a division by 0, but %c is such that the branch would never be executed if there would be a division by zero. E.g., %c could be the result of a size check.
  affine.apply
}
```

I think the consensus on such issues was, if a folder that turns dynamic information into static information (I think that's what this folder here does) would create an invalid op, then the op should not be folded. Same in this case, we should not fold the op, but also not crash. We probably also don't want to emit warnings.


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


More information about the Mlir-commits mailing list