[clang] [HLSL] Extract matrix elementwise cast operands from SSA (PR #227065)

via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 28 10:55:35 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Farzon Lotfi (farzonl)

<details>
<summary>Changes</summary>

Avoid materializing matrix operands in the hlsl.ewcast.src temporary when performing matrix-to-vector elementwise casts. Extract each element directly from the canonical matrix SSA value using its column-major flattened index.

Factor vector result construction into a shared helper so aggregate and matrix sources use the same conversion and insertion logic.

Update the matrix-to-vector CodeGen checks for both row-major and column-major layouts.

Assisted by Copilot using GPT 5.6 Sol

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


2 Files Affected:

- (modified) clang/lib/CodeGen/CGExprScalar.cpp (+50-19) 
- (modified) clang/test/CodeGenHLSL/BasicFeatures/VectorElementwiseCast.hlsl (+21-40) 


``````````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/227065


More information about the cfe-commits mailing list