[Mlir-commits] [mlir] [mlir][arith] Add constraints to the MulIOp for preventing type mismatch while folding (PR #136093)

Jakub Kuderski llvmlistbot at llvm.org
Thu Apr 17 13:47:52 PDT 2025


kuhar wrote:

> without explaining what the underlying issue is

What kind of explanation are you looking for other than "some constant returns an attribute that does not match the SSA value type"?

Thanks for linking the historical issues, I was not aware of this being identified an issue in the past. I would be great to put similar urls in the PR description to add context and be able to follow previous discussions and fixes.

For example, this piece of code provides a nice explanation for doing things a certain way: https://github.com/llvm/llvm-project/pull/88314/files#diff-c62b57552386a2a552ce6e3fe37bc23d399f2508636851b77ec6cd47fee906af.

> Because the underlying issue seems hard to fix fundamentally?

> What kind of explanation are you looking for other than "some constant returns an attribute that does not match the SSA value type"?

The issue with this PR is that it seems to work around a larger bug in a way that applies to a single instance rather than following standard compiler engineering practices and attempting to provide a general solution. For example, I see many other patterns in this file that I'd also expect to run into the same problem -- I think it applies to the other folds that use `MergeOverflow` (?). I'd expect either the other uses of this to be updated as well or a brief explanation of whether this maybe an isolated issue with this pattern if this is not the case. I don't propose to fix the universe at once, but at least see some consideration for whether we can handle the issue in the same vicinity.



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


More information about the Mlir-commits mailing list