[Mlir-commits] [mlir] [mlir][arith] Add constraints to the MulIOp for preventing type mismatch while folding (PR #136093)
Mehdi Amini
llvmlistbot at llvm.org
Thu Apr 17 16:54:47 PDT 2025
joker-eph wrote:
> If so, couldn't we just promote the ConstantLike trait to full-fledged interface with a required member called getOpFoldResultType()?
I'm not sure what that would get us? The folder still return an attribute and the consumer will try to handle it.
The problem is when this attribute type does not match the SSA value type.
> Then e.g., this PR could be spelled
I think @kuhar 's objection is on the fast that the constraints needs to exist on the pattern in the first place.
> or (preferrably) we could just bake this directly into the canonicalization/folding system.
Folding already forbids to fold to a different type, however we don't call the folder on constants themselves so it never shows up there (IIUC).
https://github.com/llvm/llvm-project/pull/136093
More information about the Mlir-commits
mailing list