[llvm] [SPIRV] Handle ptrcast between array and vector types (PR #166418)

Steven Perron via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 7 16:50:43 PST 2025


================
@@ -116,6 +116,85 @@ class SPIRVLegalizePointerCast : public FunctionPass {
     return LI;
   }
 
+  // Loads elements from an array and constructs a vector.
+  Value *loadVectorFromArray(IRBuilder<> &B, FixedVectorType *TargetType,
+                             ArrayType *SourceType, Value *Source) {
+    // Ensure the element types of the array and vector are the same.
+    assert(TargetType->getElementType() == SourceType->getElementType() &&
----------------
s-perron wrote:

I'll just remove the assert. If the number of elements is different than we the behaviour will still be equivalent.

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


More information about the llvm-commits mailing list