[ASTMatchers][Docs] make dump_ast_matchers.py read classes from sources (#203784)
With this change, `dump_ast_matchers.py` script no longer need to probe
network to search for classes.
This allows the script to run offline which is needed for
https://github.com/llvm/llvm-project/pull/165472.
The script now operates on assumption that all classes in AST/ will be
here: https://llvm.org/doxygen/ (which is true in general unless doxygen
page is down)
[llubi] Add support for undef values (#205602)
Although we are planning to deprecate the undef value, it is still
widely used in the intermediate results of the pipeline, which blocks
the pass bisection. This patch uses `freeze poison` as a refinement of
undef.
Note that the undef value evaluates to different values each time the
user is executed. So it cannot be cached like other constants. A
temporary buffer is introduced to take ownership of these values and
avoid breaking the interface (although this is a bit ugly...). This will
also be used by a follow-up patch for ptrtoint/inttoptr.
From my experience, it is enough for test case reduction of middle-end
miscompilation bugs (there are still counterexamples like
https://github.com/dtcxzyw/llvm-autoreduce/issues/61). However, when
processing backend miscompilation bugs, lli typically uses a garbage
value, so that llvm-reduce may produce an invalid result. I think we may
need to introduce two flags to migrate this issue: one for poisoning
[5 lines not shown]
[SmallVector] Out-of-line the trivially-copyable push_back grow path (#206213)
In the approximately trivially-copyable specialization, push_back's grow
path does not early return. Both Clang and GCC likely keep `this` and
`Elt` live across the out-of-line `grow_pod` call, saving and restoring
them in the prologue/epilogue. Shrink wrapping can't sink it (the saved
values are used in the store block the fast path also reaches).
Move the grow-and-store into a noinline `growAndPushBack` helper and
tail call it. The fast path needs no callee-saved registers.
`push_back(int)` drops from 14 to 7 instructions on x86-64.
```
// void vec_pb_int(llvm::SmallVectorImpl<int>&v, int x){ v.push_back(x); }
mov eax, dword ptr [rdi + 8]
cmp eax, dword ptr [rdi + 12]
jae _ZN4llvm23SmallVectorTemplateBaseIiLb1EE15growAndPushBackEi # TAILCALL
mov rcx, qword ptr [rdi]
[12 lines not shown]
[BOLT] Work around BSD sed's lack of in-place editing support (#206183)
BSD sed does not implement `-i` the same way as GNU sed. Use a
copy-and-replace approach instead of in-place editing to ensure
compatibility.
[gn] use `sources` instead of `inputs` for libc++ header copy action (#206263)
`sources` and `inputs` have the same semantics for GN action targets,
but the sync script can only handle `sources`.
Follow-up to cd98648925531663.
[libc++][NFC] Mark random_device::__padding_ as [[maybe_unused]] (#206248)
Instead of pushing and popping warnings we can just mark the offending
member as `[[maybe_unused]]`, improving compile times a bit and
simplifying the code.
[AggressiveInstCombine] Factor out the beginning of foldSelectSplitCTTZ/CTLZ into common entry point. NFC (#206220)
Both start by matching a select and a eq/ne compare with 0.
Assisted-by: claude
Reland: [NFC][Support] Implement slash-agnostic path matching in GlobPattern (#206251)
Add a SlashAgnostic option to GlobPattern to allow matching path
separators
(both forward slashes and backslashes) agnostically.
When enabled:
- We conservatively reduce the plain prefix and suffix by treating path
separators as metacharacters. This ensures that path separators are
matched via the slash-agnostic state machine rather than plain string
comparison.
- Brackets containing slashes are adjusted to match both separators.
- Character comparisons in the state machine (matchChar) treat '/' and
'\' as equivalent.
For #149886.
Reland of #202854 incorrectly reverted in #205409.
https://github.com/llvm/llvm-project/pull/202854#issuecomment-4813462549
[3 lines not shown]
[InstCombine] Optimize fcmp ord/uno logical select operations using freeze (#205076)
This pull request optimizes logical select sequences checking ordered or
unordered floating point operations.
Currently, InstCombine canonicalizes:
fcmp ord x, 0.0 AND fcmp ord y, 0.0 to fcmp ord x, y
fcmp uno x, 0.0 OR fcmp uno y, 0.0 to fcmp uno x, y
However, this canonicalization is blocked for logical selects because it
is not poison safe if the second operand evaluates to poison when the
first evaluates to NaN.
This patch enables the transformation for logical selects by inserting a
freeze on the second evaluated operand to guarantee poison safety.
Fixes #49175
[RISCV][NFC] Remove direct access to FeatureKV (#206233)
This is preparatory work for changing the representation of
FeatureKV/SubTypeKV, in which they will no longer be that easily
accessible as global variables. Therefore, get them from the subtarget
instead.
[LangRef] Clarifying the copying behaviour of byval (#205576)
The hidden copy of a byval argument can only be treated as a continuous
memcpy with the allocation size. It is incorrect to interpret it as a
load-store forwarding in the specified type, since a padding between
struct fields may still be a part of an active member of a union type.
[LifetimeSafety] Reapply liveness propagation and fix loop liveness leakage
(#205740)
Reapplies the liveness propagation fix (originally #205323, reverted in
#205687) and fixes a false positive involving conditional operators in
loops.
### Key Changes
* **Reapply**: Corrects liveness propagation through origin flows and
adds support for GNU statement expressions (`({ ... })`).
* **Loop Liveness Fix**: Resolves a false positive where temporary
origins leaked liveness across loop backedges via the conditional
operator's merge block. We now path-isolate these flows by generating
the `OriginFlowFact`s in their respective predecessor blocks (branches)
instead of the merge block.
Details about the old liveness leak. Consider this example
```cpp
for (int i = 0; i < 2; i++) {
[41 lines not shown]
[ProfileData] Introduce SampleProfileFuncOffsetTable (NFC) (#205045)
This patch introduces SampleProfileFuncOffsetTable, a unified wrapper
representing the function offset table.
Currently, the offset table is always a DenseMap. To support the
upcoming on-disk hash table (v104) for faster sample profile loading,
this patch abstracts the offset table representation. The new class
can delegate lookups to either the in-memory DenseMap or the on-disk
OnDiskIterableChainedHashTable.
This patch updates the reader to use the new wrapper's lookup and
insert interfaces. Since the on-disk path is not yet active, this
change is a non-functional change (NFC).
RFC:
https://discourse.llvm.org/t/rfc-faster-sample-profile-loading/90957/4
[Analysis] Improve readability of `KnownBits::pext` and `KnownBits::pdep` (#205176)
- Change the parameter names to `Val` and `Mask` to emphasize their semantics.
- Use `clearBits` instead of bitwise AND for increased expressiveness.
- Rewrite explanatory comments.