[Mlir-commits] [mlir] [MLIR][Vector]Add constraints to vector.shape_cast(constant) -> constant (PR #147691)
Diego Caballero
llvmlistbot at llvm.org
Tue Jul 15 11:35:17 PDT 2025
dcaballe 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?
https://github.com/llvm/llvm-project/pull/147691
More information about the Mlir-commits
mailing list