[mlir][Memref] Introduce a memref::ExtractAlignedPointerAsIndexOp
authorNicolas Vasilache <nicolas.vasilache@gmail.com>
Mon, 26 Sep 2022 15:43:20 +0000 (08:43 -0700)
committerNicolas Vasilache <nicolas.vasilache@gmail.com>
Mon, 26 Sep 2022 15:55:05 +0000 (08:55 -0700)
commitb3d48a60ff248f3d1a61435e5ad440c310b3d95c
tree819f03ce046266c4d96b0d5020dbd8499af8fa28
parentaac6629f6dcdb1ed5c34ef2c317e93b927a11b4a
[mlir][Memref] Introduce a memref::ExtractAlignedPointerAsIndexOp

As experience with memref::ExtractStridedMetadataOp grows we are
still missing a simple way to extract the pointer held by a memref
and lower to different backednds (LLVM, SPIRV, library calls).

This revision introduces a memref.extract_aligned_pointer_as_index that
returns an index containing the aligned pointer of the strided memref.

This operation is intended to be used solely as step during lowering,
it has no side effects. A reverse operation that creates a memref from
an index interpreted as a pointer is explicitly discouraged.

Differential Revision: https://reviews.llvm.org/D134651
mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
mlir/test/Dialect/MemRef/ops.mlir