From e0781c0e40d6212ef6af5c936afb581562affb19 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 12 May 2026 17:19:49 +0100 Subject: [PATCH] Just change the type when transposing #row_major to `#column_major` `matrix` types --- src/llvm_backend_expr.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/llvm_backend_expr.cpp b/src/llvm_backend_expr.cpp index 882c25232..fd148e5c5 100644 --- a/src/llvm_backend_expr.cpp +++ b/src/llvm_backend_expr.cpp @@ -819,6 +819,13 @@ gb_internal lbValue lb_emit_matrix_transpose(lbProcedure *p, lbValue m, Type *ty Type *rt = base_type(type); if (rt->kind == Type_Matrix && rt->Matrix.is_row_major != mt->Matrix.is_row_major) { + if (rt->Matrix.row_count == mt->Matrix.column_count && + rt->Matrix.column_count == mt->Matrix.row_count) { + lbValue res = m; + res.type = type; + return res; + } + GB_PANIC("TODO: transpose with changing layout"); }