[clang] Clang][HLSL] Emit constant matrix values in column-major order (PR #227356)

via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 29 08:53:29 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-hlsl

Author: Farzon Lotfi (farzonl)

<details>
<summary>Changes</summary>

Emit matrix APValues in the canonical column-major register layout, independent of the selected matrix memory layout.

When a constant is used as a row-major memory initializer, reorder its elements at the register-to-memory boundary. This preserves the physical layout of global and static row-major matrices while ensuring constexpr matrix expressions produce canonical register values.

Assisted by Cop-pilot GPT 5.6-Sol

---
Full diff: https://github.com/llvm/llvm-project/pull/227356.diff


2 Files Affected:

- (modified) clang/lib/CodeGen/CGExprConstant.cpp (+12-3) 
- (modified) clang/test/CodeGenHLSL/BasicFeatures/MatrixInitializerListOrder.hlsl (+11) 


``````````diff
The server is unavailable at this time. Please wait a few minutes before you try again.
``````````

</details>


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


More information about the cfe-commits mailing list