================
@@ -2450,6 +2450,20 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr
*E) {
llvm::Value *Init = llvm::Constant::getNullValue(EltTy);
V = Builder.CreateInsertElement(V, Init, Idx, "vecinit");
}
+
+ // Matrix initializer lists are in row-major order but the memory layout for
+ // codegen is determined by the -fmatrix-memory-layout flag (default:
+ // column-major). When the memory layout is column-major, we need to shuffle
+ // the elements from row-major to column-major order.
+ if (const auto *MT = E->getType()->getAs<ConstantMatrixType>()) {
+ if (CGF.getLangOpts().getDefaultMatrixMemoryLayout() !=
+ LangOptions::MatrixMemoryLayout::MatrixRowMajor) {
----------------
Icohedron wrote:
Since there are only two options, it doesn't really make a difference and I
don't have a strong preference.
So I can make the change.
https://github.com/llvm/llvm-project/pull/182904
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits