[llvm-branch-commits] [clang] [clang][bytecode][HLSL][Matrix] Support `ConstantMatrixType` and more HLSL casts in the new constant interpreter for basic matrix constexpr evaluation in HLSL (PR #183424)

Timm Baeder via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Feb 25 21:08:36 PST 2026


================
@@ -934,6 +934,24 @@ std::optional<APValue> Pointer::toRValue(const Context &Ctx,
       return true;
     }
 
+    // Constant Matrix types.
+    if (const auto *MT = Ty->getAs<ConstantMatrixType>()) {
+      assert(Ptr.getFieldDesc()->isPrimitiveArray());
+      QualType ElemTy = MT->getElementType();
+      PrimType ElemT = *Ctx.classify(ElemTy);
+      unsigned NumElts = MT->getNumElementsFlattened();
----------------
tbaederr wrote:

```suggestion
      unsigned NumElems = MT->getNumElementsFlattened();
```

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


More information about the llvm-branch-commits mailing list