[Mlir-commits] [mlir] [mlir][arith.constant]Fix element type of the dense attributes in target attributes to be consistent with result type in LLVM::detail::oneToOneRewrite() (PR #149787)

Mengmeng Sun llvmlistbot at llvm.org
Mon Jul 21 09:25:38 PDT 2025


MengmSun wrote:

> Well, no, the point I'm making is that LLVM lowerings should be done in one shot without intervening canonicalizations, because llvm.mlir.constant is one of the few cases where this sort of type/attribute mismatch happens ... and is expected to only be an argument to LLVM-level operations
I see. However the mixing sequence is just lowered from like

```bash
%0 = arith.constant dense<0.> : vector<192xf8E4M3FN>
our defined op %0, %args
```
 in one pass `-convert-to-llvm`. Yeah we emit `vector.shape_cast`  by lowering our defined op in the `convert-to-llvm` pass.  However even if we want to lower `vector.shape_cast` to llvm dialect before `canonicalizer`, this problem will still  expose.  It will call `ShapeCastOp::fold()` in the process of legalizing before pattern match and converting. 


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


More information about the Mlir-commits mailing list