[SLP]Analyze widened reduction leaves in the narrow type
When all leaves of an and/or/xor reduction are narrow integers widened
via zext/shl, and InstCombine packed some of them under a single zext,
collect the narrow leaves with per-lane shift amounts and masks and
build the tree in the narrow type. Narrow shls fold into the shift,
narrow ands into the mask. The result is widened back, shifted and
masked per lane before the reduction.
Fixes #198195
Reviewers: bababuck, RKSimon
Pull Request: https://github.com/llvm/llvm-project/pull/216062
[NVPTX] Expose CSE for shifts of logic operations (#213091)
SelectionDAG does not currently transpose multiple shifts of constant
bitwise operations as a group, so expressions sharing the same input
retain separate shifts.
This adds a combine for two or more AND, OR, or XOR operations that
share an input and shift amount:
```
P1 = shl (LOP X, C1), S
P2 = shl (LOP X, C2), S
P3 = shl (LOP X, C3), S
->
SX = shl X, S
P1 = LOP SX, (C1 << S) ; constants will be folded
P2 = LOP SX, (C2 << S) ; constants will be folded
[7 lines not shown]
[DWARFLinker] Unique a static data member independent of its tag (#217751)
A C++ static data member is a DW_TAG_member with DW_AT_declaration in
DWARF 4 and a DW_TAG_variable in DWARF 5 (DWARF 5 section 5.7.6). Clang
chooses between the two from -gdwarf-version alone, so both reach the
linker whenever objects built at different versions are linked.
Uniquing in the parallel linker identifies a data member by its index
among the record's DW_TAG_member children, and DW_TAG_variable children
are not counted.
```
struct S {
static const int kMask = 1;
int field;
};
```
In the example above, kMask is counted in the DWARF 4 unit and takes
[10 lines not shown]
[Reassociate]Keep fmul/fadd pairs together for fma
Do not linearize one-use contract fmul/fadd pairs into the enclosing
expression tree, so they stay fusable as fma. Unpack them only when a
repeated factor exists, so factorization still applies.
Fixes #211521
Assisted-by: Cursor
Reviewers: krzysz00, dtcxzyw
Pull Request: https://github.com/llvm/llvm-project/pull/215873
[DWARFLinker] Erase the type ref patch list with the section data (#217989)
SectionDescriptor::clearAllSectionData drops every patch list but
ListDebugDieTypeRefPatch. maybeResetToLoadedStage calls eraseSections()
on a unit which is already past Stage::Cloned, so that list outlives the
section content it points into and is then applied to the offsets of the
re-cloned content.
[AMDGPU] Address wave query review feedback
Keep the minimum and maximum waves-per-EU queries together in TargetParser, use the canonical full-SIMD-mode predicate added by the gfx13 LDS changes, and extend coverage for non-splitting and gfx13 targets.
Change-Id: I74a8180e605d6fbf4219d26bc48b2273477db1ec
[NVVM][NVPTX] Support decompress_b feature for tcgen05.mma intrinsics (#216312)
Support `decompress_b` feature for `tcgen05.mma` intrinsics in the
NVVM/NVPTX flow.
[runtimes] Escape list separators when forwarding search paths (#216169)
`CMAKE_PREFIX_PATH` and `CMAKE_PROGRAM_PATH` are forwarded to the
runtimes sub-build as `-D` arguments, but a CMake list is just a
semicolon-separated string, so `list(APPEND)` splits a multi-entry path
across several elements. The sub-build is then configured with only the
first entry, and the rest become stray positional arguments to cmake.
Configuring with `-DCMAKE_PREFIX_PATH="/aaa;/bbb"
-DCMAKE_PROGRAM_PATH="/ccc;/ddd"` and `-DLLVM_ENABLE_RUNTIMES=libunwind`
produces this runtimes configure command today:
```
-DCMAKE_PREFIX_PATH=/aaa
/bbb
-DCMAKE_PROGRAM_PATH=/ccc
/ddd
```
[13 lines not shown]
[libc] Update NSIG value and usage on Linux. (#217481)
* Increase NSIG to 65 - one greater than the maximal possible value
allowed for a signal. POSIX doesn't reference NSIG constant itself, but
is explicit (after Issue 8 / Austin Group Defect 741) that SIGRTMAX
should be strictly less than sysconf(_SC_NSIG) and all SIG* constants
should be strictly less than NSIG_MAX
(https://pubs.opengroup.org/onlinepubs/9799919799/). Note that other
libc implementations on Linux (e.g. glibc and musl) also define NSIG as
the value greater than SIGRTMAX.
* Fix a handful of uses/comments to reflect the updated semantics.
* Add `_NSIG` alias to the same value for compatibility.
[libc] Implement sysinfo (#217471)
Adds the public sysinfo function and tests. The internal wrapper already
existed. I decided to avoid defining `struct sysinfo` since it's a
kernel struct defined in the UAPI headers. Can revisit in future if
necessary.
Assisted-by: Automated tooling, human reviewed.
[clang][OpenMP] Fix thread count upper bound for target directives
Fix the UpperBound-computing ternary, which was inverted: std::min is
only reachable when UpperBound is 0, where it is a no-op, so any clause
with a bound to combine simply overwrites it.
Two consequences:
- A clause can raise the bound above a smaller one.
'target teams distribute parallel for thread_limit(8) num_threads(64)' gets a bound of 64.
- A non-constant clause pins the bound at 0 and discards every constant
clause after it, losing the bound entirely.
Additionally, let a construct split over separate 'target', 'teams' and
worksharing directives find its num_threads clause, so it agrees with
the combined spelling.
Note that the codegen changes in
`clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp` and
`clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp`
[5 lines not shown]
[lldb] Add MSVC STL formatter for std::expected (#217243)
Pretty-print MSVC STL `std::expected<T, E>` and `expected<void, E>`.
Engaged values show `Value`; unexpected alternatives show `Unexpected`.
The anonymous union is walked the same way as `optional` so PDB debug
info still finds `_Value` / `_Unexpected`.
Tests: generic C++23 MSVC STL coverage for engaged, unexpected, void,
and reference cases using PDB debug info.
Part of #24834
Assisted-by: Grok 4.6
Assisted-by: codex-5.6-high
---------
Co-authored-by: Bjorn Schobben <bjorn.schobben at aimsport.com>
[VPlan] Expand negated add operands as a subtract in VPSCEVExpander. (#215253)
Update VPSCEVExpander to try to expand adds of negative values as
subtract, instead of adding the negated operand. This matches IR
SCEVExpander behavior and improves expansions slightly.
It also avoids regressions when expanding more expressions.
Alive2 Proof: https://alive2.llvm.org/ce/z/Emgeqv
Depends on https://github.com/llvm/llvm-project/pull/215252
[clang][win] Fix __global_delete breaking __attribute__((used)) (#217753)
The `__empty_global_delete` fallback introduced in #209585 was marked
used via `llvm::appendToUsed()`, which creates a global named
"llvm.used" during codegen. `CodeGenModule::emitLLVMUsed()` later
unconditionally creates its own global of that same name at end-of-TU,
so the name collision renamed the latter to "llvm.used.1" -- a name LLVM
ignores. The result was that every `__attribute__((used))` global in the
TU silently lost its used semantics whenever a `__global_delete` wrapper
was emitted, letting those symbols be dropped.
Mark the fallback used via `CodeGenModule::addUsedGlobal()` instead, so
it joins the single llvm.used that `emitLLVMUsed()` emits.
`emitLLVMUsed()` runs well after `emitGlobalDeleteForwardingBodies()` in
`Release()`, so the fallback is still recorded in time.
Fixes a regression reported on #209585.