[all-commits] [llvm/llvm-project] 0d0215: [clang][AST] Reduce some AST node size. (#142585)

Haojian Wu via All-commits all-commits at lists.llvm.org
Tue Jun 3 12:44:30 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0d02150c3d7e8960ad0fe247baecfa76c7ce1129
      https://github.com/llvm/llvm-project/commit/0d02150c3d7e8960ad0fe247baecfa76c7ce1129
  Author: Haojian Wu <hokein.wu at gmail.com>
  Date:   2025-06-03 (Tue, 03 Jun 2025)

  Changed paths:
    M clang/include/clang/AST/Expr.h
    M clang/include/clang/AST/ExprCXX.h
    M clang/include/clang/AST/Stmt.h
    M clang/include/clang/AST/StmtCXX.h
    M clang/lib/AST/Expr.cpp
    M clang/lib/AST/ExprCXX.cpp
    M clang/lib/Serialization/ASTReaderStmt.cpp
    M clang/lib/Serialization/ASTWriterStmt.cpp

  Log Message:
  -----------
  [clang][AST] Reduce some AST node size. (#142585)

This patch reduces the size of several AST nodes by moving some fields
into the free bitfield space in the base `Stmt` class:

* `CXXForRangeStmt`: 96 → 88 bytes
* `ChooseExpr`: 56 → 48 bytes
* `ArrayTypeTraitExpr`: 56 → 48 bytes
* `ExpressionTraitExpr`: 40 → 32 bytes
* `CXXFoldExpr`: 64 → 56 bytes
* `ShuffleExpr`: 40 → 32 bytes
* `PackIndexingExpr`: 48 → 40 bytes

There are no noticeable memory savings (`Expr/Stmt` memory usage
125,824,496 vs 125,826,336 bytes for `SemaExpr.cpp`) in my testing,
likely because these node types are not among the most common in typical
ASTs.



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