[lldb] Fix ambiguous ProtocolDescriptor in the MCP unit tests under C++20 (#237270)
When building as C++20, lldb/Host/JSONTransport.h declares the concept
lldb_private::transport::ProtocolDescriptor. MCPClientTest.cpp and
ProtocolMCPServerTest.cpp have using-directives for both that namespace
and lldb_protocol::mcp, so an unqualified ProtocolDescriptor is
ambiguous between the concept and
lldb_protocol::mcp::ProtocolDescriptor, and the tests fail to compile.
Qualify the six uses, as ProtocolMCPServerTest.cpp already does
elsewhere. No change under C++17.
assisted with: claude
[analyzer] Make symbol iteration cheaper (#244865)
SymExpr::symbols() returned an llvm::iterator_range, which stores both
iterators, and each iterator owned a SmallVector worklist, so every
range-for copied worklists. The iterator operations were also out of
line, and comparing against the end iterator compared whole worklists.
Return a symbol_range that owns the worklist instead, and make the
iterator a pointer to it. The range is neither copyable nor movable, and
begin() is lifetimebound, so -Wdangling catches iterators that outlive a
temporary range. The iterators are single-pass and only meant to be
compared against end(). Also make the iterator operations inline and
skip expand() for SymbolData, which has no operands.
On some LLVM TUs (GVN, LiveVariables, RegionStore, SemaExpr) this
reduces the instructions of the static analyzer by 3.9-5.1% and the
cycles by 2.8-4.4%. Peak memory is unchanged, and so are the analyzer
statistics and diagnostics.
[5 lines not shown]
[analyzer] Avoid rebuilding AST matchers for every function (#244843)
NumberObjectConversionChecker built its whole AST matcher tree,
including a regex for matchesName, for every analyzed function body. The
matcher does not depend on the function or on the Pedantic option, so
build it once when the checker is constructed.
ObjCAutoreleaseWriteChecker and RunLoopAutoreleaseLeakChecker built and
ran Objective-C only matchers (they require Objective-C object pointer
types, message sends or @autoreleasepool) on every function body, even
in non-Objective-C translation units. Skip them when the language is not
Objective-C.
On some LLVM TUs (GVN, LiveVariables, RegionStore, SemaExpr) this
reduces the instructions of the static analyzer by 0.9-5.1% and the
cycles by 1.0-4.6% on darwin, where these checkers are enabled by
default. Peak memory is unchanged. The diagnostics are unchanged.
Assisted-by: Claude Opus 5.5
[3 lines not shown]
[llvm-objcopy][MachO] Don't create a second LC_SEGMENT in object files (#238352)
In Mach-O object files (MH_OBJECT), all sections from all segments are
stored in a single LC_SEGMENT/LC_SEGMENT_64 load command. Each section
header stores its own segment name, which the linker uses to place the
section. The load command name is normally empty, but this change does
not depend on it.
Source: [Mach-O Runtime Architecture, page
57](https://math-atlas.sourceforge.net/devel/assembly/MachORuntime.pdf).
`--add-section __FOO,__bar` looked for a load command named `__FOO`, did
not find one and added a second LC_SEGMENT to the object file, which
Apple's ld-classic rejects with error: more than one LC_SEGMENT found in
object file. For object files, add the new section to the existing load
command and keep `__FOO` as the segment name in its section header.
Similar issue with --update-section #127604
Fixes #238320
[3 lines not shown]
[InstCombine] Document requirements for transformConstExprCastCall() (NFC) (#244146)
This documents the cases in transformConstExprCastCall() that we care
about in practice, so they don't get dropped. Based on discussion on:
https://github.com/llvm/llvm-project/pull/243506
Regenerate callbr tests for inline asm operand counts
Main now prints the operand count of an inline asm operand with more than
one register, such as "regdef:GR32_NOREX2 ops:2" (#235184).
Assisted-by: Claude Opus 5.5
Regenerate PowerPC wide GPR tests for inline asm operand counts
Main now prints the operand count of an inline asm operand with more than
one register, such as "reguse:G8RC ops:2" (#235184).
Assisted-by: Claude Opus 5.5
[rtsan] Align each thread's context to a cache line (#245043)
Threads write to their contexts when they
- Enter/leave nonblocking functions
- Enter/leave disabled scopes
I observed that
1. We do this a lot
2. The contexts were 8 bytes and could be allocated side by side
This made it possible to have issues with false sharing between threads,
since each thread writes to its own context. So like, if e.g.
- T1 writes its ctx => it takes the cache line away from the other
threads
- T2 writes its ctx => it needs to pull the line back
[14 lines not shown]
[CodeGenPrepare] Don't hang on select cycles in unreachable code
When optimizeSelectInst() turns a group of selects into a branch,
getTrueOrFalseValue() looks through the selects of the group that a
select uses. In unreachable code, the selects can use themselves or
each other in a cycle, and this loop never ends. llc removes
unreachable blocks before CodeGenPrepare, so a normal llc run does not
hang.
In reachable code, the loop visits each select at most once. Stop it
after as many steps as there are selects in the group.
Assisted-by: Claude Code (Claude Opus 5.5)
[flang] Keep do concurrent structured when its branching stays in the body (#244176)
A DO loop whose raw branching is confined to its body keeps its
structured
form, with only the body folded into an scf.execute_region. Only
increment
loops qualified. A do concurrent header puts no control flow in the body
either: its indices are always integer and its mask is a test inside the
innermost loop. So a do concurrent qualifies under the same body checks.
This lets a do concurrent with, for example, a SELECT CASE in its body
lower
inside an OpenACC kernels region instead of hitting the "unstructured do
loop
in acc kernels" TODO.
The tests cover a do concurrent that keeps its structured form with a
SELECT
CASE in its body, a mask over two indices, a CYCLE, a locality
[14 lines not shown]
[CodeGen] Fix finalizeBundle for a redefinition after a dead def
Since 58f3b0dd8d7b (#155448), finalizeBundle() sets the register units
of a physical register in LocalDefsP only for the first def of the
register in the bundle, and only if that def is not dead. When a
register is defined dead and then defined again, a later read in the
bundle is not marked internal, and the BUNDLE reads the register from
outside the bundle. With -verify-machineinstrs, this gives "Using an
undefined physical register", for example after IT block insertion on
Thumb2.
Set the units for every def that is not dead, as before #155448. This
runs the loop over the units again for each such def, not only for the
first one.
This is a regression in LLVM 22: llc 21.1.8 compiles the IR that the
Thumb2 test is reduced from without the error. I did not see wrong code
from it: only the internal flag of the read and the operands of the
BUNDLE are wrong.
[2 lines not shown]
[LLVM][AutoUpgrade] Preserve operand bundles when upgrading coro.end (#245322)
When `UpgradeIntrinsicCall` upgrades `llvm.coro.end` or
`llvm.coro.end.async`, forward any operand bundles (such as WinEH `[
"funclet"(token %cp) ]`) from the original call to the newly created
call instead of dropping them.
Stack:
1. #245322 **(this PR)**
2. #245323
3. #245324
4. #245325
[Mips] Use libcalls for sqrt on MIPS I (#244947)
MIPS I has no sqrt.s and sqrt.d, but FSQRT and STRICT_FSQRT were left
legal, so llvm.sqrt and the constrained sqrt failed to select. Expand
them on MIPS I so they become calls to sqrtf and sqrt.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[AMDGPU] Remove R600 usage from clang, flang and lld tests. NFC
Test cleanup plan for removing the R600 (TeraScale) backend:
* [x] clang, flang, lld tests (this patch)
* [ ] llvm tests
Tests that only cover R600 are deleted. In tests shared with other
targets, the r600 RUN lines and their now unused checks are removed.
annotations-global.c tests annotations on globals in a non zero address
space, so it is retargeted to amdgpu, which also uses `G1`:
```
// RUN: %clang_cc1 %s -triple r600 -emit-llvm -o - | FileCheck %s --check-prefix AS1-GLOBALS
// AS1-GLOBALS: target datalayout = "{{.+}}-A5-G1"
-->
// RUN: %clang_cc1 %s -triple amdgpu -emit-llvm -o - | FileCheck %s --check-prefix AS1-GLOBALS
// AS1-GLOBALS: target datalayout = "{{.+}}-A5-G1{{.*}}"
```
[5 lines not shown]