LLVM/project 698dbee — llvm/test/Transforms/InstCombine ctpop.ll
Precommit tests
| Delta | File | |
|---|---|---|
| +41 | -0 | llvm/test/Transforms/InstCombine/ctpop.ll |
| +41 | -0 | 1 files |
Precommit tests
| Delta | File | |
|---|---|---|
| +41 | -0 | llvm/test/Transforms/InstCombine/ctpop.ll |
| +41 | -0 | 1 files |
[InstCombine] Fold trunc(ctpop(A)) + trunc(ctpop(B)) -> trunc(ctpop(A) + ctpop(B))
This allows the combine added in #231321 to kick in and fold the motivating ctpop case in automotive-bitcount:
```c
static char bits[256] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8};
int CDECL ntbl_bitcount(long int x)
{
return
bits[ (int) (x & 0x0000000FUL) ] +
bits[ (int)((x & 0x000000F0UL) >> 4) ] +
bits[ (int)((x & 0x00000F00UL) >> 8) ] +
bits[ (int)((x & 0x0000F000UL) >> 12)] +
bits[ (int)((x & 0x000F0000UL) >> 16)] +
bits[ (int)((x & 0x00F00000UL) >> 20)] +
bits[ (int)((x & 0x0F000000UL) >> 24)] +
bits[ (int)((x & 0xF0000000UL) >> 28)];
}
```
| Delta | File | |
|---|---|---|
| +5 | -12 | llvm/test/Transforms/InstCombine/ctpop.ll |
| +6 | -0 | llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp |
| +11 | -12 | 2 files |
[InstCombine] Fold ctpop(X >> C) + ctpop(X & M) -> ctpop(X & (M | (-1 << C)))
Following up from #231225, automotive-bitcount in llvm-test-suite and GCC use a "per-nibble" ctpop table lookup, where they split the operation up into smaller ctpop table lookups over chunks of the input:
```c
unsigned table_u32(unsigned x) {
static const unsigned char ctpop[16] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4};
return ctpop[x & 15] + ctpop[(x >> 4) & 15];
}
```
PR #231225 now converts the individual table lookups to ctpop intrinsics, so we're left with `ctpop(X & 0xf) + ctpop((X >> 4) & 0xf) + ctpop((X >> 8) & 0xf) + ...`. Now that `ctpop((X >> C) & M)` is canonicalized to `ctpop(X & (M << C))`, the existing `ctpop(A) + ctpop(B) -> ctpop(A | B)` fold for disjoint A and B combines most of these.
The one piece it can't handle is the top chunk of a full-width chain, which is a plain `ctpop(X >> C)` with no mask. This folds it with the lower bits directly.
This needs to come before the disjoint fold, which would otherwise combine e.g. `ctpop(X >> 12) + ctpop(X & 0xf00)` into `ctpop((X >> 12) | (X & 0xf00))`, which can't be folded any further.
| Delta | File | |
|---|---|---|
| +6 | -22 | llvm/test/Transforms/InstCombine/ctpop.ll |
| +11 | -0 | llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp |
| +17 | -22 | 2 files |
Precommit tests
| Delta | File | |
|---|---|---|
| +145 | -0 | llvm/test/Transforms/InstCombine/ctpop.ll |
| +145 | -0 | 1 files |
[InstCombine] Fold ctpop((X >> C) & M) -> ctpop(X & (M << C)) (#247998) The position of the bits doesn't matter to ctpop so we can look through the shift. As suggested in https://github.com/llvm/llvm-project/pull/231321#discussion_r4358616796, this allows the existing ctpop(A) + ctpop(B) => ctpop(A | B) combine to kick in since it now knows there are no bits in common. https://alive2.llvm.org/ce/z/jbh7T2 Tests assisted by Opus 5.5
| Delta | File | |
|---|---|---|
| +149 | -0 | llvm/test/Transforms/InstCombine/ctpop.ll |
| +9 | -0 | llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp |
| +158 | -0 | 2 files |
Multi-level tiling
Merge branch 'main' into enable_stdlibcxx_pstl_benchmarks
| Delta | File | |
|---|---|---|
| +19,205 | -18,966 | llvm/test/CodeGen/AMDGPU/amdgcn.bitcast.1024bit.ll |
| +15,666 | -15,524 | llvm/lib/Target/Hexagon/HexagonDepIICScalar.td |
| +7,746 | -8,018 | llvm/lib/Target/Hexagon/HexagonDepIICHVX.td |
| +4,870 | -4,906 | llvm/test/CodeGen/AMDGPU/memintrinsic-unroll.ll |
| +9,174 | -0 | llvm/test/CodeGen/AArch64/Atomics/aarch64-atomicrmw-lscp.ll |
| +4,456 | -4,506 | llvm/test/CodeGen/AMDGPU/amdgcn.bitcast.512bit.ll |
| +61,117 | -51,920 | 15,638 files not shown |
| +877,709 | -538,184 | 15,644 files |
[mlir][acc] Read 128-bit values in `acc.atomic.read` with `cmpxchg`
`acc.atomic.read` reads `x` with an `atomicrmw or` of zero on an integer
of the size of `x`. For a `complex<f64>`, that is an `i128`, which
the LLVM dialect verifier does not accept for integer operations of
`atomicrmw` ([LLVMMemoryOps.cpp#L509-L511][verifier]):
```mlir
acc.atomic.read %v = %x : !fir.ref<complex<f64>>, !fir.ref<complex<f64>>, complex<f64>
```
failed with:
```
'llvm.atomicrmw' op expected LLVM IR integer type
```
Read values wider than 64 bits with a `cmpxchg` of zero with zero
instead, and take the loaded value. It only stores zero where the value
[11 lines not shown]| Delta | File | |
|---|---|---|
| +41 | -0 | mlir/test/Conversion/OpenACCToLLVM/atomic.mlir |
| +15 | -9 | mlir/lib/Conversion/OpenACCToLLVM/ACCAtomicPatterns.cpp |
| +56 | -9 | 2 files |
[CodeView] Write 128bit ints as LF_(U)OCTWORD (#212241) This PR changes how 128-bit integers are read and written in CodeView. Before, we only supported 64-bit ints. Anything larger would be truncated. CodeView does have a way of encoding 128-bit values: `LF_(U)OCTWORD`. We can use this here. The main issue for us is that the Microsoft tools don't support this well. For the DIA SDK, [`IDiaSymbol::get_value`](https://learn.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/idiasymbol-get-value) succeeds, but the returned `VARIANT` is of type `VT_ERROR`. The Visual Studio debugger also fails to print 128-bit values. This isn't due to an incorrect encoding on our side. `pdbtool` from https://github.com/microsoft/pdb-rs can read the values just fine. I still think we should write `LF_(U)OCTWORD` here. MSVC doesn't support `__int128`, so Clang is alone here. If the user wants a 128 bit value, they should get it. Rust is also a user of 128-bit integers - they're available as `u128`. However, they generate a struct with 64-bit high and low words, so we're not changing anything for them.
intrusion detection: bump model version for 92c43543523554
| Delta | File | |
|---|---|---|
| +1 | -1 | src/opnsense/mvc/app/models/OPNsense/IDS/IDS.xml |
| +1 | -1 | 1 files |
[AST] Avoid typedef alias for PointerUnion member in DeclGroupRef (#248015) In #238331, `DeclGroupRef` declared `using UnionTy = llvm::PointerUnion<Decl *, DeclGroup *>;` before `UnionTy D;`. GCC 12 and earlier do not propagate `TYPE_TYPELESS_STORAGE` from `PointerUnion`'s `PunnedPointer` byte storage to pre-existing typedef variants created before template instantiation (fixed in GCC 13 by commit b332131359). As a result, `DeclGroupRef` did not inherit typeless storage and GCC's DSE dropped stores to `DeclGroupRef` before `getAddrOfPtr1()` reads, causing OpenMP parser crashes on GCC 11/12 buildbots. Declare `D` directly with `llvm::PointerUnion<Decl *, DeclGroup *>` instead of through `UnionTy`. Follow-up to #238331
| Delta | File | |
|---|---|---|
| +6 | -3 | clang/include/clang/AST/DeclGroup.h |
| +6 | -3 | 1 files |
Add the "libcpp-has-no-xyz" features only when we're testing libc++
| Delta | File | |
|---|---|---|
| +10 | -5 | libcxx/utils/libcxx/test/params.py |
| +8 | -4 | libcxx/utils/libcxx/test/dsl.py |
| +0 | -4 | libcxx/test/configs/stdlib-libstdc++.cfg.in |
| +18 | -13 | 3 files |
Add test coverage for multiple 'row_en' modifiers Assisted-By: Claude
| Delta | File | |
|---|---|---|
| +13 | -0 | llvm/test/MC/AMDGPU/exp-err.s |
| +13 | -0 | 1 files |
[AMDGPU] Support 'row_en' as a normal named-bit modifier Like the previous patch does for done, this reworks row_en from an asm string token into a normal modifier. The exp pseudos stay as they are, because codegen needs the implicit use of M0 for row_en exports, but they now all share the same real instructions. Assisted-By: Claude
Add test coverage for multiple 'done' modifiers
| Delta | File | |
|---|---|---|
| +10 | -0 | llvm/test/MC/AMDGPU/exp-err.s |
| +10 | -0 | 1 files |
AGENTS.md: update (cherry picked from commit 380e1e129a4034ed3a49abad1a40c9fd3e0ef143) (cherry picked from commit 582693dc822b22f8ab6c947a8c560e94b8418139) (cherry picked from commit 7aa1f99463ee4aebd511704a86a89e677cd2c82a)
| Delta | File | |
|---|---|---|
| +13 | -3 | AGENTS.md |
| +13 | -3 | 1 files |
*/*: Bump port revision after electron44 update (91c71936481c)
| Delta | File | |
|---|---|---|
| +1 | -1 | net-im/signal-desktop/Makefile |
| +1 | -0 | misc/paseo-desktop/Makefile |
| +2 | -1 | 2 files |
devel/electron44: Update to 44.12.0 Changelog: https://github.com/electron/electron/releases/tag/v44.12.0 Reported by: GitHub (watch releases)
[Flang][OpenMP] Model memory effects of omp.task (#246308) Add a new attribute `in_reduction_assume_bounded_recipe_effects` for the `in_reduction` clause when the memory effects of the clause are assumed to be bounded. Add code for detecting the use of a user-defined reduction in an `in_reduction` clause. Add tests for the application of bounded recipe effect attributes, and correct reporting of memory effects on omp.task. Assisted-by-AI: (Codex)
[DAG] canCreateUndefOrPoison - add VECREDUCE_AND/OR/XOR/SMIN/SMAX/UMIN/UMAX handling (#244326) Fixes #239259 None of these reductions can create undef or poison. The bitwise ones combine the bits of the elements, and the min/max ones return one of the elements. So `freeze(vecreduce_x(v))` can now become `vecreduce_x(freeze(v))`, and the freeze no longer blocks folds into the users of the reduction. An integer reduction can have a result type wider than the element type (after type legalization). Then the top bits are undef, like ANY_EXTEND, so it still returns true in that case, unless the query is poison-only. Assisted by Claude (Anthropic).
| Delta | File | |
|---|---|---|
| +193 | -0 | llvm/test/CodeGen/AArch64/freeze.ll |
| +13 | -0 | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp |
| +206 | -0 | 2 files |
[X86] EltsFromConsecutiveLoads - match reversed frozen loads (#247818) The one-use frozen load path recurses with Depth + 1, so the REVERSE match, which only runs at depth 0, is never tried for frozen loads. Keep the depth. The recursion is on the unfrozen loads, so it can't come back to this path. This merges the reversed frozen loads of the bitreverse tests in bit-manip-i*.ll and removes 106 instructions from them. Assisted-by: Claude Code (Claude Opus 5.5)
[X86] isGuaranteedNotToBeUndefOrPoisonForTargetNode - pass DemandedElts to X86ISD::VSRAI/VSHLI/VSRLI arguments (#248012) The default expansion test checks the entire argument isn't UNDEF/POISON instead of the elements we care about Add additional opcodes as we need them Pulled out of #245048
| Delta | File | |
|---|---|---|
| +21 | -22 | llvm/test/CodeGen/X86/vector-compress.ll |
| +17 | -0 | llvm/lib/Target/X86/X86ISelLowering.cpp |
| +1 | -2 | llvm/test/CodeGen/X86/vector-idiv-udiv-128.ll |
| +39 | -24 | 3 files |
review: add affected example
| Delta | File | |
|---|---|---|
| +72 | -0 | llvm/test/CodeGen/AMDGPU/amdgpu-uniform-temporal-divergence.ll |
| +72 | -0 | 1 files |
[TableGen][Decoder] Remove -ignore-fully-defined-operands It's now unused.
| Delta | File | |
|---|---|---|
| +0 | -9 | llvm/utils/TableGen/DecoderEmitter.cpp |
| +0 | -1 | utils/bazel/llvm-project-overlay/llvm/BUILD.bazel |
| +0 | -1 | llvm/utils/gn/secondary/llvm/lib/Target/AMDGPU/Disassembler/BUILD.gn |
| +0 | -11 | 3 files |
[ARM][NFC] Fix compilation with GCC <9 (#248007) Old GCC has problems with templated lambdas. Fixup of https://github.com/llvm/llvm-project/pull/246744.
| Delta | File | |
|---|---|---|
| +8 | -4 | llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp |
| +8 | -4 | 1 files |
css: update country flags, partial sync with upstream (https://github.com/lipis/flag-icons), add license
[AMDGPU][Disassembler] Drop -ignore-fully-defined-operands (#247590) ed3597e2f7c4 added -ignore-fully-defined-operands to all targets as a temporary option keeping the old decoder behaviour, where operands with all bits known are not decoded. AMDGPU is the last target still using it. Without the option, such operands are decoded by the generated decoder, so the code adding the gds operand of DS instructions on targets without GDS and the a16 operand of BVH instructions is not needed anymore. This also means DS instructions on gfx90a, gfx942 and gfx950, where the gds bit is decoded, no longer get a second gds operand, and the BVH instructions that have no a16 operand no longer get one. Assisted-By: Claude
| Delta | File | |
|---|---|---|
| +1 | -8 | llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp |
| +1 | -2 | llvm/lib/Target/AMDGPU/CMakeLists.txt |
| +2 | -10 | 2 files |
[SimplifyLibCalls] Fix the insertion point of sincospi calls (#247928) The sincospi transform put its new call right after the instruction that defines the argument. That breaks when the argument comes from an invoke or callbr (nothing can follow them in their block) or from a phi followed by more phis, and InstCombine crashes. This uses getInsertionPointAfterDef() to find a valid spot, and skips the transform for callbr which has none. Fixes #247889 Assisted-by: Claude Code (Opus 5.5)
| Delta | File | |
|---|---|---|
| +223 | -0 | llvm/test/Transforms/InstCombine/sincospi.ll |
| +13 | -7 | llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp |
| +236 | -7 | 2 files |
Fix a race when two stop signals are delivered concurrently For multithreaded processes it is possible that two stop signals are delivered concurrently (or close enough so that both threads enter cursig's stop handling). There is a window between the check in userret and the cursig handler where two threads can race. Recheck the stop condition using proc_suspend_check_locked at the start of the cursig stop transaction to close the race. This is similar to what is done in proc_trap. Reported by Acts1631
| Version | Delta | File | |
|---|---|---|---|
| 1.367 | +2 | -1 | sys/kern/kern_sig.c |
| +2 | -1 | 1 files | |
css: update country flags, partial sync with upstream, add license and readme files