[Mlir-commits] [mlir] [mlir][ptr] Add int_to_ptr && ptr_to_int ops (PR #190527)

Fabian Mora llvmlistbot at llvm.org
Sun Apr 5 11:28:57 PDT 2026


fabianmcg wrote:

The existence of such operations doesn't necessarily mean that they are good or required. I've yet to see an example where ptr-int casts are truly needed instead just being the convenient/existing option to express something.

Just to give an example, of a classical example. I think a tagged ptr is not a ptr, but a packed object holding a ptr and some extra bits. As such, we should model those with first class semantics:

```C++
taggedPtr = makeTaggedPtr(addr, bits);
// taggedPtr + 1 or *taggedPtr doesn't make sense.
addr = getPtr(taggedPtr);
// Do whatever with addr.
```

> In AI models, some complex operators require the use of such operations.

Do you have an example? I'd like to see an example where these ops are truly needed.

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


More information about the Mlir-commits mailing list