[clang] [HLSL][Matrix] Add Matrix Bool and represent them as i32 elements (PR #171051)

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 13 07:28:25 PST 2025


================
@@ -104,7 +104,10 @@ llvm::Type *CodeGenTypes::ConvertTypeForMem(QualType T) {
   if (T->isConstantMatrixType()) {
     const Type *Ty = Context.getCanonicalType(T).getTypePtr();
     const ConstantMatrixType *MT = cast<ConstantMatrixType>(Ty);
-    return llvm::ArrayType::get(ConvertType(MT->getElementType()),
+    llvm::Type *IRElemTy = ConvertType(MT->getElementType());
+    if (Context.getLangOpts().HLSL && T->isConstantMatrixBoolType())
----------------
farzonl wrote:

C\C++ today does not support boolean matrix types and even if they did they would be i1 types when we want booleans in HLSL to be i32 `ConvertTypeForMem` is making that change for us.

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


More information about the cfe-commits mailing list