[Mlir-commits] [mlir] [mlir][core|ptr] Add `PtrLikeTypeInterface` and casting ops to the `ptr` dialect (PR #137469)

Matthias Springer llvmlistbot at llvm.org
Sun Apr 27 07:30:33 PDT 2025


================
@@ -52,6 +121,36 @@ def Ptr_PtrAddOp : Pointer_Op<"ptr_add", [
   }];
 }
 
+//===----------------------------------------------------------------------===//
+// ToPtrOp
+//===----------------------------------------------------------------------===//
+
+def Ptr_ToPtrOp : Pointer_Op<"to_ptr", [Pure]> {
----------------
matthias-springer wrote:

How could existing IR such as the following one be rewritten with `to_ptr` instead of `extract_aligned_pointer_as_index`?

```mlir
%0 = memref.extract_aligned_pointer_as_index %m : memref<10xf32>
vector.print %0 : index
```


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


More information about the Mlir-commits mailing list