[Mlir-commits] [mlir] [mlir][arith] Check for valid IR in BitcastOp::fold. (PR #100743)

Ingo Müller llvmlistbot at llvm.org
Fri Jul 26 07:12:24 PDT 2024


https://github.com/ingomueller-net commented:

> In which context are we folding invalid IR?

Before the folder is called, the IR looks like this:

```mlir
%0 = arith.constant 0 : i32
%1 = arith.bitcast %0 : i32 to i64
```

That's invalid because `i32` is not `BitcastOp::areCastCompatible` to `i64`.

The folder doesn't verify that but instead attemps to create an `IntegerAttr` with type `i32` and an `APInt` value of type `i64`, which breaks an assertion in the call stack `IntegerAttr::get`.

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


More information about the Mlir-commits mailing list