[Mlir-commits] [mlir] [mlir][ptr] Add constantop convertion (PR #204846)

Fabian Mora llvmlistbot at llvm.org
Fri Jun 19 09:07:39 PDT 2026


================
@@ -370,6 +380,35 @@ LogicalResult TypeOffsetOpConversion::matchAndRewrite(
   return success();
 }
 
+//===----------------------------------------------------------------------===//
+// ConstantOpConversion
+//===----------------------------------------------------------------------===//
+
+LogicalResult ConstantOpConversion::matchAndRewrite(
+    ptr::ConstantOp op, OpAdaptor adaptor,
+    ConversionPatternRewriter &rewriter) const {
+  mlir::TypedAttr value = op.getValue();
+  Type resultType = getTypeConverter()->convertType(op.getType());
+  if (!resultType)
+    return rewriter.notifyMatchFailure(op, "Couldn't convert the result type");
+
+  if (llvm::dyn_cast<ptr::NullAttr>(value)) {
----------------
fabianmcg wrote:

```suggestion
  if (dyn_cast<ptr::NullAttr>(value)) {
```

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


More information about the Mlir-commits mailing list