[all-commits] [llvm/llvm-project] 0e8478: [CIR] Zero-init array-new with trivial ctor (#205611)
adams381 via All-commits
all-commits at lists.llvm.org
Thu Jun 25 09:02:46 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 0e847869ab8dde02815d82b67c7f0bb834653b51
https://github.com/llvm/llvm-project/commit/0e847869ab8dde02815d82b67c7f0bb834653b51
Author: adams381 <adams at nvidia.com>
Date: 2026-06-25 (Thu, 25 Jun 2026)
Changed paths:
M clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp
A clang/test/CIR/CodeGen/new-array-init.cpp
M clang/test/CIR/CodeGen/new.cpp
M clang/test/CIR/CodeGen/paren-list-agg-init.cpp
M clang/test/CIR/CodeGenCXX/new-array-init.cpp
Log Message:
-----------
[CIR] Zero-init array-new with trivial ctor (#205611)
emitNewArrayInitializer hit errorNYI for a value-initialized array new of
a trivially-constructible element (new T[n]()), where the trailing
parentheses mean zero-initialization. Route the trivial-ctor branch
through the existing tryMemsetInitialization() helper, following classic
CodeGen: a zero-initializable element gets operator new[] plus a single
memset to 0, while a non-zero-initializable element (an array of
pointers-to-data-member, whose null value is -1) declines the memset and
falls through to the constructor loop value-initializing each element.
Also add the getParent()->isEmpty() early return. tryMemsetInitialization
builds the memset through the Address overload of createMemSet so the
destination alignment is preserved.
Found building the SPEC CPU 2026 LLVM benchmark (723.llvm_r / 823.llvm_s)
with ClangIR.
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