[-Wunsafe-buffer-usage] Speed up warning a bit (#226605)
Checking a type is faster than calling ignoreUnsafeBufferIn...(). The
latter has to get the Stmt's begin loc, look up diagnostic state and
suppression, etc. And the type check lets us skip most Stmts cheaply, so
do that first.
In a sampling profile of 48 Chromium TUs (which are built with
-Wunsafe-buffer-usage), UnsafeBufferUsageReporter's
ignoreUnsafeBufferInLibcCall() and ignoreUnsafeBufferInContainer() were
1.35% and 1.29% of the total compile time, and 3.75% for
checkUnsafeBufferUsage() as a whole.
For 60 random Chromium TUs drawn with probability proportional to their
compile time, sum over all TUs:
CPU time: 242.9 s => 237.5 s, -2.2%
instructions: 2452.6e9 => 2371.8e9, -3.3%
No behavior change.
[X86][APX] Precommit test for BLSI/BLSMSK i8 patterns with EGPR (NFC) (#226793)
The i8 BLSI/BLSMSK patterns always select the VEX forms, so when only
extended GPRs (r16-r31) are available the operands get spilled instead
of using the EVEX forms.
Tests for #226796
Assisted-by: Claude Code
Co-authored-by: Claude Opus 5.5 (1M context) <noreply at anthropic.com>
X86: Mark EFLAGS dead on the FP control word OR (#227017)
Fix custom inserters to add dead flags.
Co-authored-by: Claude Opus 5 <noreply at anthropic.com>
[ADT] Extract SmallDenseMapStorage from SmallDenseMap (NFC) (#226882)
This patch extracts the inline and heap bucket and occupancy storage
management from SmallDenseMap into a new helper class,
densemap::detail::SmallDenseMapStorage, and updates SmallDenseMap to
use it via composition.
This is part of the effort to replace CRTP in DenseMapBase with
composition (see #168255 and #226664). With both DenseMapStorage and
SmallDenseMapStorage in place, the next patch will remove CRTP from
DenseMapBase.
Assisted-by: Antigravity
[clang] Add one-entry cache for ASTContext::getDeclAttrs() (#226610)
In libc++, almost every decl has attributes, so ASTContext::DeclAttrs
has 50k-150k entries when using libc++. But attributes are often queried
several times in a row for the same decl (e.g. `D->hasAttr<A>() ||
D->hasAttr<B>()`). Numbers for some Chromium TUs:
getDeclAttrs() same Decl as table
calls previous call size
blink logical_box_fragment.cc 19.6M 88.4% 156132
glic_webui_contents_manager.cc 16.0M 86.1% 144545
tflite kernels/conv.cc 6.1M 91.2% 52623
So add a one-element cache. AttrVecs are allocated separately, so
keeping a pointer to the result is safe.
Build time for 60 random Chromium TUs drawn with probability
proportional to their compile time:
[8 lines not shown]
don't send spill or oversized blocks as WRITE_EMBEDDED
send_do_embed() treated every embedded BP as a DRR_WRITE_EMBEDDED
candidate. Spill blocks (DMU_OT_SA) have to go as DRR_SPILL, and an
embedded block larger than SPA_OLD_MAXBLOCKSIZE cannot be represented
on the receiver unless the stream carries large_blocks: dump_dnode()
clamps the object's block size to 128K in the DRR_OBJECT record, so
the receive then rejects the DRR_WRITE_EMBEDDED.
Skip those cases in send_do_embed() so do_dump() emits a spill record
or splits the block into SPA_OLD_MAXBLOCKSIZE chunks instead.
On receive, accept only BP_EMBEDDED_TYPE_DATA for DRR_WRITE_EMBEDDED.
Add ZTS send_embedded_spill_block (canned pool with an embedded
spill) and send_embedded_large_block (1M zstd block, send with and
without -L).
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Kamil Monicz <kamil at monicz.dev>
[2 lines not shown]
[OpenMP] Preserve host capture lifetimes in frontend lowering
Mark captured alloca/global storage nofreeobj when Clang emits a synchronous
host parallel call. This preserves lifetime across outlining without claiming
that escaped capture slots are noalias or immutable, and without extending the
lifetime guarantee to pointers loaded from those slots.
Mark OpenMPIRBuilder's fresh host capture aggregate noalias and nofreeobj.
This covers the lowering path used by Flang and Clang's IRBuilder mode.
Replace callback Attributor seeding with frontend and translation tests,
including escaped captures, heap references, firstprivate pointers, debug
wrappers, serialized regions, and optimized load hoisting with OpenMPOpt
disabled. Refresh the affected parameter-attribute checks.
[ADT] Extract SmallDenseMapStorage from SmallDenseMap (NFC) (#226882)
This patch extracts the inline and heap bucket and occupancy storage
management from SmallDenseMap into a new helper class,
densemap::detail::SmallDenseMapStorage, and updates SmallDenseMap to
use it via composition.
This is part of the effort to replace CRTP in DenseMapBase with
composition (see #168255 and #226664). With both DenseMapStorage and
SmallDenseMapStorage in place, the next patch will remove CRTP from
DenseMapBase.
Assisted-by: Antigravity
llvm: add LoongArch target support, not enabled by default
Note there is ongoing work to add LoongArch support to the base system,
but having target support in llvm is an essential component.
This must be explicitly enabled using WITH_LLVM_TARGET_LOONGARCH.
Reviewed by: dim
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D59899
AArch64: Mark the NZCV def dead for unused overflow results (#227018)
Avoid implicitly depending on later recomputed dead flags.
Co-authored-by: Claude Opus 5 <noreply at anthropic.com>
[HLSL] Preserve matrix layout as AST storage metadata (#225519)
fixes #213996
fixes #211977
fixes https://godbolt.org/z/rhTYx1KGf
Keep matrix layout metadata on noncanonical matrix types without
affecting type identity, overload resolution, deduction, or mangling.
Normalize matrix values to column-major register representation when
loading from memory, and convert them back to the destination layout
when storing. Preserve layout metadata through typedefs, arrays,
records, resources, serialization, AST import, and template
substitution.
This change also starts the reversal of encoding row\column major via
indexing changes in codegen and instead ops for a stable index but
transpose intrinsics for swapping matrix majorness.
[lldb][test] Don't add pdb to explicitly tagged debug info categories (#226999)
`LLDBTestCaseFactory` appends `"pdb"` to `dbginfo_categories` whenever
the class sets `TEST_WITH_PDB_DEBUG_INFO=True`. When a test method is
tagged with explicit debug info categories
(`@add_test_categories(["dwarf"])`), `dbginfo_categories` is the set
intersection of the method's categories and the known debug info
categories, not a list, so the class failed to load with
```
AttributeError: 'set' object has no attribute 'append'
```
and dotest reported the whole file as UNRESOLVED.
Only add "pdb" when the method is not tagged, which is also the only
case where the default categories are used.
rdar://188589961