[llvm] [SPIR-V] Fix some GEP legalization (PR #150943)

Steven Perron via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 29 07:18:43 PDT 2025


Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/150943 at github.com>


================
@@ -593,54 +604,64 @@ void SPIRVEmitIntrinsics::maybeAssignPtrType(Type *&Ty, Value *Op, Type *RefTy,
 
 bool SPIRVEmitIntrinsics::walkLogicalAccessChain(
     GetElementPtrInst &GEP,
-    const std::function<void(Type *, uint64_t)> &OnStaticIndexing,
+    const std::function<void(Type *, uint64_t)> &OnLiteralIndexing,
     const std::function<void(Type *, Value *)> &OnDynamicIndexing) {
+  // We only rewrite i8* GEP. Other should be left as-is.
+  // Observation so-far is i8* GEP always have a single index. Making sure
+  // that's the case.
----------------
s-perron wrote:

This is more than an observation. The semantics of the GEP force this to be true. The first index will index the pointer, then you end up with an i8, which cannot be indexed. 

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


More information about the llvm-commits mailing list