================
@@ -7095,6 +7096,45 @@ class APValueToBufferConverter {
     return true;
   }
 
+  bool visitVector(const APValue &Val, QualType Ty, CharUnits Offset) {
+    const auto *VT = Ty->castAs<VectorType>();
+    unsigned VectorLength = Val.getVectorLength();
+
+    if (VT->isExtVectorBoolType()) {
+      // Special handling for OpenCL bool vectors: we need to pack the vector
+      // of 1-bit unsigned integers into a single integer with the 
corresponding
+      // bits set, then write out the resulting integer.
+
+      CharUnits VecWidthBytes = Info.Ctx.getTypeSizeInChars(VT);
+      assert(VecWidthBytes.getQuantity() * Info.Ctx.getCharWidth() >=
+                 VectorLength &&
+             "Vector type is smaller than the number of bool elements?");
+
+      APSInt Bits(VecWidthBytes.getQuantity() * Info.Ctx.getCharWidth());
----------------
zygoloid wrote:

```suggestion
      unsigned VecWidthBits = Info.Ctx.getTypeSize(VT);
      assert(VecWidthBits >= VectorLength &&
             "Vector type is smaller than the number of bool elements?");

      APSInt Bits(VecWidthBits);
```

https://github.com/llvm/llvm-project/pull/66894
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to