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

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 29 08:14:43 PDT 2025


================
@@ -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.
----------------
Keenuts wrote:

Ah that's right, double checked and it's indeed invalid IR, even with multiple `i32 0` indices. Changing this.

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


More information about the llvm-commits mailing list