[clang] [HLSL][Matrix] Make matrix truncation respect default matrix memory layout (PR #184280)

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 3 10:01:39 PST 2026


================
@@ -3118,14 +3118,15 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
       SmallVector<int> Mask;
       unsigned NumCols = MatTy->getNumColumns();
       unsigned NumRows = MatTy->getNumRows();
-      unsigned ColOffset = NumCols;
-      if (auto *SrcMatTy = E->getType()->getAs<ConstantMatrixType>())
-        ColOffset = SrcMatTy->getNumColumns();
-      for (unsigned R = 0; R < NumRows; R++) {
-        for (unsigned C = 0; C < NumCols; C++) {
----------------
farzonl wrote:

Why did we need to flatten this?  Is Mask Order important I thought the only thing that matters is which indices we put into the mask?

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


More information about the cfe-commits mailing list