[clang] [Clang][HLSL] Keep matrix SSA values in column-major order (PR #227087)

Sarah Spall via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 29 14:51:31 PDT 2026


================
@@ -2364,11 +2364,8 @@ LValue CodeGenFunction::EmitMatrixElementExpr(const MatrixElementExpr *E) {
     llvm::Value *Mat = EmitScalarExpr(E->getBase());
     Address MatMem = CreateMemTemp(E->getBase()->getType());
     QualType Ty = E->getBase()->getType();
-    llvm::Type *LTy = convertTypeForLoadStore(Ty, Mat->getType());
-    if (LTy->getScalarSizeInBits() > Mat->getType()->getScalarSizeInBits())
-      Mat = Builder.CreateZExt(Mat, LTy);
-    Builder.CreateStore(Mat, MatMem);
     Base = MakeAddrLValue(MatMem, Ty, AlignmentSource::Decl);
+    EmitStoreOfScalar(Mat, Base, /*isInit=*/true);
----------------
spall wrote:

could we just call EmitStoreOfMatrixScalar here instead to remove a layer of indirection? It looks like this code path is guaranteed to call it via EmitStoreOfScalar?

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


More information about the cfe-commits mailing list