[GenericDomTreeConstruction] Store the semidominator value in Label (#207603)
runSemiNCA's eval() stores the vertex with the minimal semidominator in
Label and dereferences NumToInfo[Label]->Semi to compare it. Store the
semidominator (Semi) value directly in Label instead, so eval compares
by number with no NumToInfo lookup.
[ELF] Add target-specific relocation scanning for SPARCV9 (#206284)
Implement SPARCV9::scanSectionImpl, following the pattern established
for x86 and other targets. This merges the getRelExpr and TLS handling
for SHF_ALLOC sections into the target-specific scanner, enabling
devirtualization and eliminating abstraction overhead.
- Inline relocation classification into scanSectionImpl with a switch
on relocation type, replacing the generic rs.scan() path.
- Use processR_PC for PC-relative relocations and processR_PLT_PC for
PLT relocations.
- Handle TLS LE relocations directly with checkTlsLe.
- Simplify getRelExpr to only handle relocations needed by
relocateNonAlloc and preprocessRelocs.
[LifetimeSafety] Support container interior paths and invalidations
This patch completes the implementation of path-sensitive lifetime tracking by supporting container interior paths (`.*`) and deep-nested invalidation.
- Enables `PathElement::getInterior` generation in `FactsGenerator` for GSL Owners and Views (e.g. member functions, function parameters, lambda captures).
- Removes bypass checks in `FactsGenerator::handleInvalidatingCall` to track container invalidation on fields.
- Updates `Checker` to use strict prefix comparison (`isStrictPrefixOf`) for container invalidations, ensuring invalidation of container contents (interior) correctly invalidates iterators but not other sibling fields.
- Reorganizes tests in `invalidations.cpp` by resolving duplicates and distributing them logically.
- Updates unit tests and sema tests with correct expectations for interior paths.
TAG=agy
CONV=2cfd8d00-18d7-4a03-8d78-2aba2f9a8f23
[LifetimeSafety] Support container interior paths and invalidations
This patch completes the implementation of path-sensitive lifetime tracking by supporting container interior paths (`.*`) and deep-nested invalidation.
- Enables `PathElement::getInterior` generation in `FactsGenerator` for GSL Owners and Views (e.g. member functions, function parameters, lambda captures).
- Removes bypass checks in `FactsGenerator::handleInvalidatingCall` to track container invalidation on fields.
- Updates `Checker` to use strict prefix comparison (`isStrictPrefixOf`) for container invalidations, ensuring invalidation of container contents (interior) correctly invalidates iterators but not other sibling fields.
- Reorganizes tests in `invalidations.cpp` by resolving duplicates and distributing them logically.
- Updates unit tests and sema tests with correct expectations for interior paths.
TAG=agy
CONV=2cfd8d00-18d7-4a03-8d78-2aba2f9a8f23
[GlobalISel] Remove LegacyLegalizerInfo (#197308)
After #197238, #197370, #197371, #197374, #197375, #197377, #197378 and
#197379, this removes the legacy rules from global isel.
The above patches attempt to make all _tested_ operations legal, but
have only gone through the operations that have llvm tests. If more
fallbacks are now found to be happening, the other operations from
#197238 might be needed.
[libc++] Add an ABI flag to optimize mersenne_twister_engine (#206423)
Instead of updating the status array every time `operator()` is called,
we can instead update it once every time the entire array has been read.
That allows the compiler to vectorize the updating code, improving
performance.
Apple M4:
```
Benchmark old new Difference % Difference
---------------------------------------- ------- ------- ------------ --------------
std::mt19937::operator() 1.39 0.65 -0.74 -53.26%
std::mt19937::operator()_(into_array) 172.92 80.69 -92.23 -53.34%
std::mt19937_64::operator() 1.46 0.99 -0.47 -31.99%
std::mt19937_64::operator()_(into_array) 187.31 108.10 -79.21 -42.29%
```
Fixes #197221
[libc++] Use std::to_chars to format thread::id and canonicalize the representation across platforms (#181624)
This makes printing `thread::id` faster, since we avoid a bunch of
boilerplate code that isn't optimized away. It also avoids including
`<sstream>` and `<__locale>`, cutting the time to parse `<thread>` in
half.
This also changes the output when printing the id on a platform that
uses a pointer as the underlying type. I don't think that's a problem,
since the thread id isn't in any way stable. It also makes the output
consistent across all platforms we support.
[libcxxabi] Re-enable `thread_local_destruction_order.pass.cpp` on FreeBSD (#186129)
The underlying bug has been fixed in https://reviews.freebsd.org/D55826.
[InstCombine] Fold fpto{u,s}i of int-cast fdiv into {u,s}div (#205853)
Fixes #205305.
Adds an InstCombine fold for the pattern `fpto{u,s}i (fdiv ({u,s}itofp
X), C)` to `{u,s}div X, C`.
Safe when
- Unsigned: C > 0 and the integer width N <= the FP mantissa width p.
- Signed: C != 0 and N - 1 <= p, excluding (X == INT_MIN, C == -1).
See linked issue for detailed reasoning.
[InstCombine] Fold commuted add of udiv/urem by two (#206272) (#207462)
Fixes #206272.
`SimplifyAddWithRemainder` folds `(X / C0) * C1 + (X % C0) * C2`,
treating `and X, lowmask` as a remainder and `lshr X, N` as a division.
The commuted form `add (and X, C), (lshr X, N)` was missed because the
operand-order swap only recognized a real `urem`/`srem`.
Now the fold is tried with both operand orders instead of relying on
that swap. Verified with Alive2.
Supersedes #207249 (re-opened from the correct account; already
incorporates the both-operand-orders refactor suggested there by
nikic).
Prepared with AI assistance per the [LLVM AI Tool
Policy](https://llvm.org/docs/AIToolPolicy.html); not a "good first
issue".
[3 lines not shown]
[MC][NFC] Store SubTypeKV names as string table (#207580)
This moves the large SubTypeKV arrays to .rodata, as they no longer
contain the key pointers that need to be relocated.
Additionally, remove the largely redundant CPUNames arrays and integrate
the AArch64 aliases into the sorted string table. There was really no
need to introduce these 17 kiB arrays solely for including AArch64
aliases in help output.... (added in b6c22a4)
[GlobalISel] Add or_and_and pattern from SelectionDAG (#204618)
This PR adds the `fold or (xor x, y), (x and/or y) --> or x, y` pattern
from SelectionDAG to GlobalISel.
[CodeGen][NFC] Store CPU model index in SubTypeKV (#207351)
Instead of storing the pointer to the CPU model, store all CPU models in
an array and store the index. This is preliminary work for moving
SubTypeKV to .rodata.
NB: the scheduling models also take a fair amount of space in
.data.rel.ro, with SchedModels ~13kiB, ModelProcResources ~57kiB.
[GenericDomTreeConstruction] Use 0-based DFS numbering (#207524)
Number DFS-visited nodes from 0 and drop the unused index-0 sentinel
from NumToNode/NumToInfo/IDoms.
`Unvisited = 0` marks unvisited nodes by DFS. 0 is now the DFS root, or
the virtual root for postdominators.
Decrease the inline capacity for NumToNode/NodeInfos, which doesn't seem
to matter. sqlite3's p90 block count is 29.
[libc++] Mark LWG4098 as resolved (#206295)
Already implemented and tested in the scope of the full implementation
for `adjacent_view` (1e15dbe311eb08462e7a68fcb8b5850632e24aff).
Closes #105353
[SPARC] Don't combine misaligned memory ops with BSWAP (#206345)
Doing it will result in a misaligned LD*A/ST*A instruction, which will
raise a bus error.
This should fix the failure in `clamscan` test.
[LifetimeSafety] Support field-sensitivity in lifetime tracking
This patch enables field-sensitivity when tracking lifetimes of nested objects.
- FactsGenerator now generates `PathElement::getField` for `MemberExpr` accesses, mapping fields to loans.
- LoanPropagation now propagates field paths along flow facts, appending fields to base loans.
- Removes false-positive warnings in `invalidations.cpp` where modifications to one field were incorrectly reported as invalidating iterators/pointers to another field.
- Adds comprehensive unit tests checking nested field access and placeholder fields.
TAG=agy
CONV=2cfd8d00-18d7-4a03-8d78-2aba2f9a8f23