[Mlir-commits] [mlir] [MLIR][Vector]Add constraints to vector.shape_cast(constant) -> constant (PR #147691)
Mengmeng Sun
llvmlistbot at llvm.org
Mon Jul 21 02:49:07 PDT 2025
MengmSun wrote:
> I'm probably missing something but https://github.com/llvm/llvm-project/blob/main/mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp#L251
>
> ```
> return LLVM::detail::oneToOneRewrite(op, LLVM::ConstantOp::getOperationName(),
> adaptor.getOperands(), op->getAttrs(),
> *getTypeConverter(), rewriter);
> ```
>
> Could we just convert the attributes here? The name of the `oneToOneRewrite` parameter is `targetAttrs` so I understand it's expected that we pass a target-converted attribute? It's probably good to look at what other invocations to this method are doing...
>
> Another options:
>
> ```
> template <typename SourceOp, typename TargetOp,
> template <typename, typename> typename AttrConvert =
> AttrConvertPassThrough>
> class VectorConvertToLLVMPattern : public ConvertOpToLLVMPattern<SourceOp> {
> public:
> ```
>
> It looks like `AttrConvert` can be instantiated to something that is actually doing the type conversion, instead of just passing the type through?
I have submitted [[mlir][arith.constant]Fix element type of the dense attributes in target attributes to be consistent with result type in LLVM::detail::oneToOneRewrite()](https://github.com/llvm/llvm-project/pull/149787) to implement the 1st proposal. Please review and tell me if it's acceptable.
https://github.com/llvm/llvm-project/pull/147691
More information about the Mlir-commits
mailing list