[Mlir-commits] [mlir] [mlir][arith] Check for valid IR in BitcastOp::fold. (PR #100743)
Mehdi Amini
llvmlistbot at llvm.org
Fri Jul 26 07:55:00 PDT 2024
joker-eph wrote:
> > 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`.
It's not clear to me when should the folder be resilient to invalid IR though: this is what I mean about "In which context are we folding invalid IR?" ; this is a general question beyond the specific IR you have at hand: I need to know how you end up in this situation instead of the specific invalid IR that triggers this crash.
https://github.com/llvm/llvm-project/pull/100743
More information about the Mlir-commits
mailing list