[all-commits] [llvm/llvm-project] dcc2c1: [RISCV] Reduce ManualCodeGen for segment load/stor...

Kito Cheng via All-commits all-commits at lists.llvm.org
Tue Sep 23 12:16:12 PDT 2025


  Branch: refs/heads/release/21.x
  Home:   https://github.com/llvm/llvm-project
  Commit: dcc2c1c933bedee2d01860ac37f2947f16c569ea
      https://github.com/llvm/llvm-project/commit/dcc2c1c933bedee2d01860ac37f2947f16c569ea
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2025-09-22 (Mon, 22 Sep 2025)

  Changed paths:
    M clang/include/clang/Basic/riscv_vector.td

  Log Message:
  -----------
  [RISCV] Reduce ManualCodeGen for segment load/store intrinsics. NFC

Operate directly on the existing Ops vector instead of copying to
a new vector. This is similar to what the autogenerated codegen
does for other intrinsics.

This reduced the clang binary size by ~96kb on my local Release+Asserts
build.


  Commit: f14551dbc4e8b698f59a5757446d5af12880547f
      https://github.com/llvm/llvm-project/commit/f14551dbc4e8b698f59a5757446d5af12880547f
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2025-09-22 (Mon, 22 Sep 2025)

  Changed paths:
    M clang/include/clang/Basic/riscv_vector.td

  Log Message:
  -----------
  [RISCV] Reduce ManualCodeGen for RVV intrinsics with rounding mode. NFC

Operate directly on the existing Ops vector instead of copying to
a new vector. This is similar to what the autogenerated codegen
does for other intrinsics.


  Commit: 77a3b0eda3610cdda11a9f2bdeda18dc4e49bc95
      https://github.com/llvm/llvm-project/commit/77a3b0eda3610cdda11a9f2bdeda18dc4e49bc95
  Author: Kito Cheng <kito.cheng at sifive.com>
  Date:   2025-09-22 (Mon, 22 Sep 2025)

  Changed paths:
    M clang/include/clang/Basic/riscv_vector.td
    M clang/lib/CodeGen/TargetBuiltins/RISCV.cpp

  Log Message:
  -----------
  [RISCV] Refactor RVV builtin code generation for reduce compilation time [NFC] (#154906)

Extract ManualCodegen blocks from riscv_vector.td to dedicated helper
functions in RISCV.cpp to improve compilation times and code
organization.

This refactoring:
- Reduces riscv_vector_builtin_cg.inc from ~70,000 lines to ~30,000
lines
- Extracts lots of ManualCodegen blocks into helper functions in
RISCV.cpp
- Moves complex code generation logic from TableGen to C++
- Marks extracted functions with LLVM_ATTRIBUTE_NOINLINE to prevent
excessive inlining in EmitRISCVBuiltinExpr's large switch statement,
which would cause compilation time to increase significantly

Performance Impact on AMD Ryzen 9 3950X 16-Core with SSD (Release build)
with GCC 11:

Before: real 1m4.560s, user 0m0.529s, sys 0m0.175s
After:  real 0m22.577s, user 0m0.498s, sys 0m0.152s

Which reduced around 65% of compilation time.

During this refactoring, I also found few more opportunities to optimize
and simplify the code generation logic, but I think leave to next PR
since it already change a lot of code.

Fix #88368


Compare: https://github.com/llvm/llvm-project/compare/e625a781211e...77a3b0eda361

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