[lldb] Add option to log in JSONL format (#205758)
This patch adds a -j option to the log command that prints all log
messages as their own single-line JSON objects. The resulting output log
file is then a valid JSONL file with the message and metadata as their
own fields.
The motivation for this change is that writing any tooling that
analyzses LLDB logs is currently very difficult to get right. Our
current log messages often span multiple lines, and even the metadata
(e.g., stacktraces) span multiple lines. Even worse, the message content
is effectively arbitrary bytes (such as memory values) that need can
only be parsed back into a series of log messages via several
heuristics.
assisted-by: claude
[clang-doc] Remove unused simple_ilist comparison operators (NFC) (#206309)
These operator== and operator!= templates in YAMLGenerator.cpp were
never called. They went in as infrastructure that never got wired up,
and now a cleanup exposed them under -Wunused-template. Remove the dead
code.
NFC. Part of #202945.
[VPlan] Remove internal linkage from findUserOf templates (NFC) (#202974)
The `findUserOf` function templates are `static` in a header, so every
translation unit that includes it gets its own internal-linkage copy.
That's a latent ODR hazard, and it trips `-Wunused-template` in TUs that
don't instantiate them. Dropping `static` gives them external linkage
(templates are implicitly inline, so nothing else changes).
NFC: linkage-only change.
Part of #202945.
[JITLink][ORC] Clean up unused and assert-only function templates (NFC) (#202973)
These function templates trip `-Wunused-template`.
In `aarch32.cpp`, `writeRegister` has no callers, so it's removed.
`checkRegister` is only used inside `assert`, so it gets compiled out in
release builds (`-DNDEBUG`) and never instantiates; it's marked
`[[maybe_unused]]`. Same story for `stubAndPointerRangesOk` in
`OrcABISupport.cpp`, which is only used in asserts.
NFC.
Part of #202945.
[Mips] Remove unused function templates (NFC) (#202971)
A few function templates in the Mips MC layer have no callers anywhere,
so they never get instantiated and trip `-Wunused-template`. They all
live in `.cpp` files, so this is plain dead-code removal.
`MipsELFObjectWriter.cpp`: `copy_if_else` and `find_best` lost their
only user when `sortRelocs` was rewritten in #104723. The
`FindBestPredicateResult` enum existed only for `find_best`, so it goes
too.
`MipsDisassembler.cpp`: `DecodeDAHIDATIMMR6` isn't referenced by any
`DecoderMethod`. The r6 DAHI/DATI instructions decode through its
sibling `DecodeDAHIDATI`, which is what the generated tables actually
call.
NFC: removes uninstantiated templates only.
Part of #202945.
[Object][ELF] Remove internal linkage from header function templates (NFC) (#202969)
These `static` function templates live in a header, so every translation
unit that includes it gets its own internal-linkage copy. That's a
latent ODR hazard, and it trips `-Wunused-template` in every TU that
doesn't instantiate them. Dropping `static` gives them external linkage
(templates are implicitly inline, so nothing else changes). This matches
`getElfArchType` in the same file, which is already a plain `inline`
helper.
NFC: linkage-only change.
Part of #202945
[Clang][Sema] Fix crash on init-list of array with incomplete element type (#205973)
## Summary
Fixes #140685.
clangd (and clang itself, with assertions enabled) crashes on:
```cpp
struct MoveOnly;
void test() {
MoveOnly (&&list)[1] = {};
}
```
with
```
Assertion failed: (CanDeclareSpecialMemberFunction(RD) && "doing special member lookup into record that isn't fully complete"), function LookupSpecialMember, file SemaLookup.cpp
[41 lines not shown]
[Clang] Handle deduced auto types within AtomicType (#197874)
This patch fixes handling of deduced types nested inside AtomicType.
Previously, GetContainedDeducedTypeVisitor did not recurse through
AtomicType nodes, causing getContainedDeducedType() to incorrectly
return null for types such as:
**_Atomic(__auto_type)**
As a result, undeduced AutoType instances could bypass semantic checks
and later reach codegen/type layout paths, eventually triggering
assertions such as:
_!A->getDeducedType().isNull() && "cannot request the size of an
undeduced or dependent auto type_
This patch adds AtomicType traversal support to
GetContainedDeducedTypeVisitor so contained deduced types are properly
[15 lines not shown]
[clang][Lex] Optimize the FileCheckPoints search in Preprocessor (#206356)
Resolves a FIXME and improved linear search by replacing with a binary
search on the FileCheckPoints SmallVector in Lex/Preprocessor.
- used std::upper_bound to find the upper bound of the Start position.
- handle special case if the Start is less than all elements in
FileCheckPoints so returns a nullptr;
- else return the dereferenced value of the CheckPoint just before Start
point.
[GVN] Add test for scoped-alias metadata dropped on coerced loads (NFC) (#206416)
Precommit test capturing current behavior: when GVN forwards a wider
load to a narrower load at an offset, dropUnknownNonDebugMetadata
strips !noalias and !alias.scope from the surviving wider load even
though that load is unchanged and the metadata stays valid.
[GlobalISel][AArch64] Tweak `G_FREEZE` legalization, don't push it when that makes code illegal (#204785)
In the combine rule
// Convert freeze(Op(Op0, NonPoisonOps...)) to Op(freeze(Op0), NonPoisonOps...)
// when Op0 is not guaranteed non-poison
def push_freeze_to_prevent_poison_from_propagating ...
Don't push the `freeze` if `freeze(Op0)` is illegal and we've already
run the legalizer.
Also make `G_FREEZE`, `G_IMPLICIT_DEF`, `G_CONSTANT_FOLD_BARRIER` legal for
`s128` operands.
Two new tests added:
- `free-push-legal.mir` checks that we don't push `freeze` towards operands
post-legalization when doing so makes the code illegal.
[7 lines not shown]
[mlir][affine] Remove redundant copyNests.clear() after declaration (NFC) (#206348)
The clear() call immediately following the declaration of copyNests is
redundant since a default-constructed DenseSet is already empty. Remove
it.
[mlir][arith] Add ValueBoundsOpInterface external models for the arith integer CeilDiv, RemSI, RemUI, MaxUI, MinUI. (#204966)
Add ValueBoundsOpInterface external models for the arith integer
CeilDiv, RemSI, RemUI, MaxUI, MinUI.
Since the ValueBoundsConstraintSet infrastructure interprets unsigned
integers as signed, unsigned ops needed special handling.
In the unsigned ops we first verify that the integers can be proven as
positive, and if yes we add the appropriate constraints to the set.
The only exception for that is the RemUI, since the bound is only
dependent on the divider we don't care what's the sign of the lhs.
---------
Co-authored-by: Nir Herscovici <nir.herscovici at mobileye.com>
[GVN] Preserve scoped-alias metadata on coerced loads
When forwarding a wider load to a narrower load at an offset, GVN drops
the wider load's metadata. !noalias and !alias.scope are independent of
the load type and offset, and the wider load is not moved and still
accesses the same memory, so they remain valid and are now kept instead
of dropped.
[GVN] Add test for scoped-alias metadata dropped on coerced loads
Precommit test capturing current behavior: when GVN forwards a wider
load to a narrower load at an offset, dropUnknownNonDebugMetadata
strips !noalias and !alias.scope from the surviving wider load even
though that load is unchanged and the metadata stays valid.
[RISCV][P-ext] Add codegen for packed reduction sum (#206004)
The predsum/predsumu instructions reduce a packed vector to a scalar:
each element is sign- or zero-extended to the accumulator width and
added to the scalar accumulator rs2.
This patch adds the llvm.riscv.predsum and predsumu intrinsics along
with isel patterns for target-legal results (predsum.bs/hs/ws, plus
the paired predsum.dbs/dhs for a GPRPair source on RV32).
The remaining combinations have a target-illegal result and are split
in ReplaceNodeResults:
* On RV64: An i32 accumulator reduces at i64 and is then truncated
(the 32-bit source is zero-extended first).
* On RV32: An i64 accumulator reduces to a 32-bit partial sum and is
widening-accumulated via wadda/waddau.