[CIR][NFC] Simplify convertABIArgInfo (#239872)
This change simplifies convertABIArgInfo in the CIR calling convention
lowering pass. Direct argument info conversion is extracted into a
separate function and rewritten significantly to improve clarity and
simplify the logic.
Assisted-by: Cursor / claude-opus-5.5
[libc][math] Correct tanhf16 subnormal rounding and range reporting (#236480)
Select correctly rounded tanhf16 results for nonzero half subnormals and
signed minimum-normal inputs. Preserve signed zero and report inexact,
with
underflow/ERANGE when the rounded result is tiny.
Tests: smoke tests with GCC 13 and Clang 18 on x86-64 Linux, plus MPFR
4.2.1
value checks over all 63,488 finite half encodings in four rounding
modes.
Reporting checks cover nonzero subnormals and four adjacent boundary
encodings using tininess after rounding, separately from MPFR's
underflow flag.
Assisted-by: GitHub Copilot
Signed-off-by: sriramshastry <sriramshastry at gmail.com>
[libc][math] Preserve the sign of tiny asinhf16 zeros (#236479)
Preserve the input sign when asinhf16's existing tiny-input correction
rounds
to zero. Add directed-rounding regressions for positive and negative
minimum
subnormals. This is a signed-zero fix, not a general underflow-reporting
fix.
Tests: focused smoke tests with GCC 13 and Clang 18 on x86-64 Linux.
MPFR 4.2.1 value/sign checks cover both zeros and all 2,046 nonzero half
subnormals in all four rounding modes; they are not exception/errno
checks.
Assisted-by: GitHub Copilot
Signed-off-by: sriramshastry <sriramshastry at gmail.com>
[GlobalISel] Simplify demanded bits through TRUNC, XOR and SELECT
## What it is
Extend GlobalISel demanded-bits simplification through `G_TRUNC`, `G_XOR`, and `G_SELECT`, following SelectionDAG's demand propagation and known-bits handling. Enable these operations as combiner roots in AArch64 and AMDGPU.
- Propagate truncation demand to the wider source and narrow constant logical right shifts (`trunc (lshr X, C)` to `lshr (trunc X), C`) when no shifted-in bits are demanded and legality allows it.
- Simplify XOR using known bits: drop an operand, narrow to a type with free trunc/zext, or turn it into `G_OR` (`disjoint` only when that holds for all bits), `G_AND`, or a NOT, and commute XOR with logical shifts when the target allows it. Unlike SelectionDAG, keep the XOR constant unshrunk: without a `targetShrinkDemandedConstant` equivalent, shrinking can make an encodable AArch64 logical immediate unencodable.
- Propagate demand through both SELECT value arms and intersect their known bits. Leave the condition unchanged and preserve full demand for shared producers unless an individual use can safely bypass them. Fold to a constant when all demanded bits are known.
- Use known bits, not only constant operands, to bypass multi-use `G_AND`/`G_OR`/`G_XOR` in `simplifyMultipleUseDemandedBits`, and route a root's operand use around such a def when it cannot be simplified in place.
- Keep `ashr (sext_inreg X, W), C` arithmetic unless none of its `C + BW - W` sign-fill bits are demanded, so AArch64 keeps selecting SBFX.
- Look through `G_UBFX` when folding into TB(N)Z on AArch64, so the narrowed shifts still select a single `tbz`/`tbnz`.
- Share XOR/shift profitability between selectors: `isDesirableToCommuteXorWithShift` takes the shift direction, XOR mask, shift amount, and vector-ness instead of an `SDNode` (NFC for SelectionDAG).
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[RISCV] Materialize rotated LUI values with LUI+RORI (#240099)
RISCVMatInt already uses RORI (or TH_SRRI) when a constant rotated left
fits in 12 bits, materializing it as ADDI+RORI. Extend this to constants
that rotate into a sign-extended 32-bit value with zero low 12 bits,
which
LUI can load directly, and materialize them as LUI+RORI. These are masks
that wrap around bit 63 and the tagged or boxed constants of JIT
compilers. For example 0xfffc000000000001 now takes
```
lui a0, 32767
rori a0, a0, 26
```
instead of li+slli+addi.
Found via riscvlint.
Assisted-by: Claude Code (Claude Fable 5.1)
[CIR] Keep the object's address space in data member pointer access (#240509)
Remove one more missing address space cast feature.
ClangIR fails to compile a data member access through a member pointer
when the object is not in the default address space, such as SYCL device
code on SPIR-V where references are generic (addrspace(4)):
```cpp
struct S { int a; int b; };
int load(S &s, int S::*mp) { return s.*mp; }
error: 'cir.cast' op result type address space does not match the
address space of the operand
```
The member address was always created in the default address space,
regardless of where the object lives. It now uses the object's address
space, matching classic codegen:
```llvm
%memptr.offset = getelementptr inbounds i8, ptr addrspace(4) %0, i64 %1
[2 lines not shown]
Replace the TrueSearch program with truesearchd
- The `truesearch` service runs two units, `truesearchd` and
`truesearch-indexer`. Samba uses `spotlight backend = truesearch`.
- Middleware writes `/etc/truesearchd/truesearch.conf` while the index
dataset is mounted. A dataset gets one `[target]` row if it holds an
SMB share with Spotlight search on or a WebShare share with search on,
or if it is mounted beneath such a share. Time Machine shares, home
shares and private datasets shares are not indexed.
- Encrypted datasets are indexed. A dataset keeps its index in a
disabled row while its shares are disabled, its share service does
not run, its pool is not imported, or it is locked. The index of a row
that leaves the file is dropped.
- A reload waits until both daemons release the datasets of the rows
that it disabled or removed. A dataset destroy, a dataset lock and a
pool export release the rows first. A pool import configures
TrueSearch.
- `.system/truesearchd` replaces `.system/truesearch`. On a data pool,
it is encrypted with the pwenc secret as a raw key. Middleware does
[17 lines not shown]
[clang-format] fix: recognize `.mts` and `.cts` as TypeScript files (#236122)
Hello,
This PR fixes recognition of `.mts` and `.cts` as TypeScript in
`clang-format`, `git-clang-format`, and `clang-format-diff.py`, matching
[TypeScript 4.7's supported
extensions](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-7.html#new-file-extensions).
Also include `.mjs` and `.cjs` in `clang-format-diff.py`'s default
filter. Add regression tests and update documentation.
[lld-macho] Avoid slowing down markLive for class stubs (#240242)
llvm/llvm-project#238486 added the class-stub edge to `addSym()` in
markLive:
```cpp
if (ObjCStubsSection::isObjCClassStubSymbol(s))
if (auto *classSym = in.objcStubs->lookupClassSymbol(s))
addSym(classSym, prev);
```
On large links that don't use class stubs, removing those three lines
makes markLive about 15% faster. There are two causes:
- `isObjCClassStubSymbol()` reads the name of every newly live symbol,
which is memory markLive otherwise never touches.
- The recursive call keeps clang from inlining `addSym()` into the drain
loop. So every symbol reference, including the many that find the symbol
already live, pays for a call: 29 instructions per already-live
[37 lines not shown]
[libc][sys/shm] Implement shmctl and add remaining constants. (#239839)
`shmctl` is a POSIX function (see
[docs](https://pubs.opengroup.org/onlinepubs/9799919799/functions/shmctl.html#))
that provides a variety of shared memory control operations.
On Linux, it can be implemented as a simple wrapper around SYS_shmctl
syscall.
Provide the implementation as a simple syscall wrapper, define
(Linux-specific) `struct shmid_ds` definition,
and provide the remaining Linux-specific macro definitions used as flag
values for `shmctl` and
other shared memory functions from `<sys/shm.h>`.
This concludes adding the basic `<sys/shm.h>` functionality.
graphics/graphviz: remove duplicate lang/tcl BUILD_DEPENDS, again
When ${TCLTK_DEFAULT} != 8.6:
(graphics/graphviz): Error: graphics/graphviz depends on nonexistent
origin lang/tcl91; Please contact maintainer of the port to fix
this.
PR: 300092
[clang][DepScan] Use explicit module cache in SubdirectorySearch test (#240488)
This unit test previously built a module without passing an explicit
`-fmodules-cache-path`. That could otherwise default to an unwriteable
location on some envs. Create & pass an writable temp directory instead.
intel/intel_pmc: Add support for Cannon Lake through Meteor Lake
Match the platform by CPU model and attach on acpi with PWRM at
0xfe000000; the PMC is not PCI-enumerable on these platforms.
SLP_S0_RES offsets and granularities follow each generation's PCH
Family Datasheet Volume 2. A mismatch between the LPIT residency
counter address and SLP_S0_RES is reported on attach.
Reviewed by: olce, adrian
Differential Revision: https://reviews.freebsd.org/D59596
[LoadStoreVectorizer] Fix offsets for extended narrow indices (#223500)
`getConstantOffsetComplexAddrs` attempts to compute a constant offset
between two loads/stores by looking through
matching `zext`/`sext` instructions. There are two miscompliations I
have discovered in this logic:
* First Bug: Scaling the difference by the element stride could wrap
prematurely. For example, `i8 64 * 4` became zero, making accesses 256
bytes apart appear identical. Normalize the difference to the pointer
index width before scaling.
* Second Bug: The first no-wrap proof treated a narrow modular
difference as an exact extended difference. Compare `IdxDiff` and the
add constant in `N+1` bits and require the difference to lie between
zero and the constant.
* Third Bug: similar to above, but in the "Second attempt" logic
Alive2 proofs of miscompiles:
[23 lines not shown]
[OpenMP] Add 'target loop' directive (#238448)
`#pragma omp target loop` has no AST node and crashes in clang. See
https://godbolt.org/z/6b64T91Gh
This PR adds the support. It is lowered like `target simd`: SPMD on the
device, one team, one thread.
mail/hydroxide: Update 0.2.32 => 0.2.33
This release adds ability to pass ProtonMail CAPTCHA.
Commit log:
https://codeberg.org/emersion/hydroxide/compare/v0.2.32...v0.2.33
Port changes:
* Upstream moved to Codeberg, so set USE_FORGEJO.
* Workaround USE_RC_SUBR and WRKSRC collision by
using post-extract target.
* Update pkg-message for better clarification.
Reported by: Repology
Approved by: osa, vvd (mentors, implicit)
Differential Revision: https://reviews.freebsd.org/D61270
[clang-format] Avoid spurious blank lines after configured macros (#238619)
Configured `Macros` can make `SeparateDefinitionBlocks: Always` insert
an empty line inside a later `if/else` block because block indices in
the macro expansion pass still refer to the unexpanded line sequence
Skip definition block separation during macro expansion and process the
reconstructed macro calls, where those indices are valid
Fixes #237253
Assisted-by: OpenAI Codex