[llvm] [SPIR-V] Scalarize vector of pointers for ptrtoint/inttoptr (PR #184817)

Dmitry Sidorov via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 5 09:59:38 PST 2026


================
@@ -3281,9 +3342,144 @@ void SPIRVEmitIntrinsics::parseFunDeclarations(Module &M) {
   }
 }
 
+bool SPIRVEmitIntrinsics::scalarizeVectorOfPointersArgs(Module &M) {
----------------
MrSidims wrote:

That is my bad, I've created a lazy reproducer in https://github.com/llvm/llvm-project/issues/184638 introducing vector of pointers in the module by putting them as kernel arguments. While technically it's a valid IR - it's not a real-life example.

So, rewriting function arguments is dangerous as it may result in a change of ABI of a module. We probably can only do this if a function is not externally visible. I would suggest to drop `scalarizeVectorOfPointersArgs` from the current revision. If we face a real-world example when vector of pointers is passed to an externally visible function, then it's probably be a better idea to convert vector of pointers to a vector of integers during LLVM IR to SPIR-V (or whatever target) lowering (these integers width must patch DataLayout-provided pointer's width), this vector can be intermediately converted to vector of pointers by inttoptr instruction to be then unrolled.

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


More information about the llvm-commits mailing list