[Mlir-commits] [mlir] [mlir][spirv-to-llvm] Add conversion for spirv.PtrAccessChain (PR #232945)

Arseniy Obolenskiy llvmlistbot at llvm.org
Thu Oct 22 01:11:09 PDT 2026


================
@@ -376,6 +376,41 @@ class AccessChainPattern : public SPIRVToLLVMConversion<spirv::AccessChainOp> {
   }
 };
 
+/// Converts `spirv.PtrAccessChain` and `spirv.InBoundsPtrAccessChain` to
+/// `llvm.getelementptr`. Unlike `spirv.AccessChain`, the base pointer is
+/// treated as pointing into an array of its pointee type and the `element`
+/// operand selects the array element, so it becomes the first GEP index (in
+/// place of the constant 0 used for `spirv.AccessChain`). The remaining
+/// indices then descend into the pointee exactly as for `spirv.AccessChain`.
+/// The in-bounds variant additionally sets the `inbounds` flag on the GEP.
----------------
aobolensk wrote:

I think in the code this comment could be shorter

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


More information about the Mlir-commits mailing list