[Mlir-commits] [mlir] [mlir][Vector] Teach how to materialize UB constant to Vector (PR #125596)

Diego Caballero llvmlistbot at llvm.org
Mon Feb 3 15:55:11 PST 2025


================
@@ -437,6 +437,9 @@ void VectorDialect::initialize() {
 Operation *VectorDialect::materializeConstant(OpBuilder &builder,
                                               Attribute value, Type type,
                                               Location loc) {
+  if (auto poisonAttr = dyn_cast<ub::PoisonAttrInterface>(value))
+    return builder.create<ub::PoisonOp>(loc, type, poisonAttr);
+
   return arith::ConstantOp::materialize(builder, value, type, loc);
----------------
dcaballe wrote:

Not sure. `arith::ConstantOp` and `ub::PoisionOp` seem somewhat unrelated. Would that mean that all the `ConstantLike` ops should be materialized through `arith::ConstantOp`?

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


More information about the Mlir-commits mailing list