[all-commits] [llvm/llvm-project] f8f0f9: [HLSL][Matrix] Add APValue and ConstExpr evaluator...

Deric C. via All-commits all-commits at lists.llvm.org
Thu Mar 5 09:46:01 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f8f0f93236b2aee6b63a454c05cc2876568f8972
      https://github.com/llvm/llvm-project/commit/f8f0f93236b2aee6b63a454c05cc2876568f8972
  Author: Deric C. <cheung.deric at gmail.com>
  Date:   2026-03-05 (Thu, 05 Mar 2026)

  Changed paths:
    M clang/include/clang/AST/APValue.h
    M clang/include/clang/AST/PropertiesBase.td
    M clang/include/clang/AST/TypeBase.h
    M clang/lib/AST/APValue.cpp
    M clang/lib/AST/ASTImporter.cpp
    M clang/lib/AST/ExprConstant.cpp
    M clang/lib/AST/ItaniumMangle.cpp
    M clang/lib/AST/MicrosoftMangle.cpp
    M clang/lib/AST/TextNodeDumper.cpp
    M clang/lib/AST/Type.cpp
    M clang/lib/CodeGen/CGExprConstant.cpp
    M clang/lib/Sema/SemaTemplate.cpp
    A clang/test/AST/HLSL/ast-dump-APValue-matrix.hlsl
    M clang/test/CodeGenHLSL/BoolMatrix.hlsl
    A clang/test/SemaHLSL/Types/BuiltinMatrix/MatrixConstantExpr.hlsl

  Log Message:
  -----------
  [HLSL][Matrix] Add APValue and ConstExpr evaluator support for matrices (#178762)

Fixes #168935

This PR adds basic support for matrix APValues and a ConstExpr evaluator
for matrices.
- ConstExpr evaluation changes:
  - Matrix initializer list
  - Matrix HLSL elementwise cast
  - Matrix HLSL aggregate splat
  - Vector HLSL matrix truncation
  - Int HLSL matrix truncation
  - Float HLSL matrix truncation
- Matrix APValue:
  - AST dumper and serialization
  - Value flattening

Note that APValue matrices hold its elements in row-major order
irrespective of the `-fmatrix-memory-layout` flag.
The `-fmatrix-memory-layout` is for codegen, not semantics, so the
decision of which memory layout to use for the matrix APValue can be
independent of the memory layout for codegen.

There are also a number of places expecting switch case coverage over
all APValues but which do not currently support matrix APValues. I have
added placeholder llvm_unreachables to these places for the matrix
APValue, as these places can not currently be exercised in clang tests
(AFAIK).

Assisted-by: claude-opus-4.5



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list