[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

Sarah Spall via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 3 11:26:27 PST 2025


================
@@ -2016,8 +2016,9 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const {
   case Type::Vector: {
     const auto *VT = cast<VectorType>(T);
     TypeInfo EltInfo = getTypeInfo(VT->getElementType());
-    Width = VT->isExtVectorBoolType() ? VT->getNumElements()
-                                      : EltInfo.Width * VT->getNumElements();
+    Width = (VT->isExtVectorBoolType() && !getLangOpts().HLSL)
+                ? VT->getNumElements()
+                : EltInfo.Width * VT->getNumElements();
----------------
spall wrote:

EltInfo.Width should be the size of the Element type in the vector, and that is set to be an i32 in CodeGenTypes. If that changed in the future to be an integer of a different size, this would still be correct.

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


More information about the cfe-commits mailing list