[libc++] Add MSVC's implementation of exception_ptr for Windows (#94977)
Microsoft is happy to contribute our implementation of exception_ptr for
Windows, under the Apache License v2.0 with LLVM Exception that our STLs
share.
* excptptr.cpp, copied verbatim as:
https://github.com/microsoft/STL/blob/e36ee6c2b9bc6f5b1f70776c18cf5d3a93a69798/stl/src/excptptr.cpp
* <exception>, copied verbatim as:
https://github.com/microsoft/STL/blob/e36ee6c2b9bc6f5b1f70776c18cf5d3a93a69798/stl/inc/exception
The implementation was integrated into libc++:
* Deleted STL copy of <exception>. All standard exception classes are
already provided by libc++'s standard headers.
* Replaced MSVC STL naming conventions and macros (_STD,
_CRTIMP2_PURE, _Ref_count_base, _Ptr_base, _EXCEPTION_RECORD, etc.)
with standard libc++ style and identifiers (_LIBCPP_EXPORTED_FROM_ABI,
__double_leading_underscore variable/function names).
* Replaced internal MSVC CRT headers (<trnsctrl.h>,
[16 lines not shown]
ValueTracking: Generalize known frexp exponent range to any constant (#208316)
Extend computeKnownExponentRangeFromContext beyond the special case of a
dominating fabs(V) compare against exactly 1.0 to any finite limit.
Generalizing below 1.0 exposes a soundness issue: frexp(0) has exponent
0, so a bound derived assuming a nonzero value could wrongly exclude it
when the limit implies a negative maximum exponent. Query fcZero and
clamp the maximum exponent to at least 0 when the source may be zero.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
[lldb] Improved formatting of 'register read' command. (#188049)
Made alignment of 'register read' command's output to be dynamic to the
register's name lengths -> `=` signs of different registers align when
printed as sets, also aligned when picked in some custom ordering. No
alignment between separate sets is included (i.e, each set is aligned to
itself only). Sample change:
```
Micro-architectural Registers:
r_pc = 0x0000108c main.xexe`main + 20 at main.c:5:5
instr_trace_r_init_print = 0x00
wb_csr_file_r_mstatus = 0x00000000
wb_csr_file_r_mie = 0x00000000
```
This example is changed into:
```
[9 lines not shown]
[clang] more useful error message for decomposition declaration missing initializer (#127924)
#90107
Diagnostic message for decomposition declaration missing an initializer
only highlights the declared identifier. This change adds an additional
diagnostic message to highlight the token found where the initializer
was expected. So, for example:
auto [a, b] S = {1, 2}
The new error points to 'S' and says that 'S' was found where an
initializer was expected.
Triple: Move OS/vendor/environment names into a def file (#208722)
Extract the component name lists into a macro .def file, similar
to how many targets do for CPU names. The arch/subarch names are
left alone because they have trickier manual parsing logic.
Co-Authored-By: Claude (Opus 4.8) <noreply at anthropic.com>
clang/AMDGPU: Forward host system includes in offload compiles (#208783)
Commit 640079288c5e merged the AMDGPU toolchain subclasses but dropped
the HIPAMDToolChain::AddClangSystemIncludeArgs override, which forwarded to
the host toolchain.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
[lldb] Simplify creating RegisterSets in DynamicRegisterInfo (#208592)
`DynamicRegisterInfo::GetRegisterSetIndexByName` is only used in
`DynamicRegisterInfo::SetRegisterInfo` so I inlined it and removed the
function. I also noticed that `m_set_names` is only used in this
function for setup, so I made it a local variable instead of a member.
[CIR] Generalize the special member attribute into func_info and add a callee resolver (#207261)
The `cxx_special_member` slot on `cir.func` becomes a general slot named
`func_info`, so facts about a function that are not special member facts
can join later without redesign.
Nothing about the special member forms changes. The attribute stays the
same union of the constructor, destructor, and assignment forms. Each
form keeps its shape and its embedded record type, and the CXX ABI
lowering still replaces that type with the converted one. The FuncOp
helpers keep their names, so passes that read the special member facts
do not change.
The printed keyword on `cir.func` changes from `special_member` to
`func_info`, so the old spelling no longer parses. The existing tests
update their check lines with no other change.
Calls gain a resolver named `resolveCallee` that returns the function a
direct call targets, so a pass standing at a call can read the facts
[5 lines not shown]
[asan][test] Fix Posix/new_array_cookie_with_new_from_class.cpp to work for arm targets (#208378)
arm targets, and arm64 targets on Darwin, use a 2-pointer array cookie
size. Update the test to support that.
Assisted-by: Claude Code
rdar://181775880
AMDGPU: Migrate Analysis/Transforms tests to amdgpu subarch triple (1)
Mechanically migrate the command-line target spelling on RUN lines from
-mtriple=amdgcn ... -mcpu=<gfx> to the folded subarch triple form (e.g.
-mtriple=amdgpu9.00-amd-amdhsa), dropping the redundant -mcpu.
This first batch covers Analysis and Transforms tests. Tests whose output
materially depends on -mcpu (e.g. opt runs that record a target-cpu attribute,
or cost-model tests whose default subtarget differs) are left for separate
handling. This begins a series of ~62 PRs covering backend tests.
Co-Authored-By: Claude <noreply at anthropic.com> (Claude-Opus-4.8)
ValueTracking: Generalize known frexp exponent range to any constant
Extend computeKnownExponentRangeFromContext beyond the special case of a
dominating fabs(V) compare against exactly 1.0 to any finite limit.
Generalizing below 1.0 exposes a soundness issue: frexp(0) has exponent
0, so a bound derived assuming a nonzero value could wrongly exclude it
when the limit implies a negative maximum exponent. Query fcZero and clamp
the maximum exponent to at least 0 when the source may be zero.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
[lldb-mcp] Replace byte forwarding with a protocol-aware multiplexer (#208506)
To serve several LLDB instances behind one endpoint it has to act as a
multiplexer. This PR adds a Multiplexer that presents a unified MCP
server to the client. It answers initialize and tools/list locally, and
forwards tools/call and the resource requests to the different instances
through an mcp::Client (added in #208371), relaying the answer back.
For now, this still drives a single backend. Discovering and routing
across several instances is coming next.
Assisted-by: Claude
Reapply "[PGO][ICP] Prevent indirect call promotion to functions with incompatible target features" (#208774)
Reverts llvm/llvm-project#208079
We're still seeing build failures without this, so reapply for now.
[mlir][xegpu] Add support for 1D SLM case in vector-to-xepgu (#208276)
Currently vector-to-xegpu only support 2D SLM buffers. However
load/store_matrix op definition allows 1D access.
Assisted by: Claude
utils/AMDGPU: Fold -mcpu across piped tools and llvm-objdump triples
Generalize the triple migration to RUN lines that pipe several tools (e.g. opt | llc, or llc | llvm-objdump), each carrying its own matching triple and -mcpu. When every -mcpu on the line names the same foldable target and there is one amdgcn triple per -mcpu, fold them all. Also recognize the llvm-objdump --triple= form (not just -mtriple=).
Co-Authored-By: Claude <noreply at anthropic.com> (Claude-Opus-4.8)
utils/AMDGPU: Handle generic targets in triple migration script
Map the gfx*-generic -mcpu values to their major-subarch triples (e.g. gfx9-4-generic -> amdgpu9.4, gfx12-generic -> amdgpu12) and widen the -mcpu regex to match hyphenated generic names, so RUN lines using -mtriple=amdgcn -mcpu=<generic> fold into the subarch triple.
Co-Authored-By: Claude <noreply at anthropic.com> (Claude-Opus-4.8)
utils/AMDGPU: Add test triple migration helper scripts
Add scripts to incrementally migrate AMDGPU lit tests from the
`-mtriple=amdgcn ... -mcpu=<gfx>` command-line form to the folded
sub-architecture triple form (e.g. -mtriple=amdgpu9.00-amd-amdhsa).
amdgpu-migrate-test-triples.py rewrites RUN lines, folding the -mcpu
subtarget into the triple subarch and dropping -mcpu. It is conservative:
only lines with a single plain gfx (or device-alias) -mcpu and a single
amdgcn -mtriple are touched. amdgpu-migrate-test-triples-batch.sh drives a
batch: rewrite, run lit, and revert any file that fails so only passing
migrations remain. A README documents usage.
Co-Authored-By: Claude <noreply at anthropic.com> (Claude-Opus-4.8)
utils/AMDGPU: Also migrate disabled RUN lines (XUN/xUN/RUNX)
Recognize commented-out RUN line variants (XUN:, xUN:, RUNX:) kept for future re-enabling, so their amdgcn triples are folded into the subarch form along with the active RUN lines.
Co-Authored-By: Claude <noreply at anthropic.com> (Claude-Opus-4.8)
AMDGPU: Add script to pin default subtarget in tests
Adds amdgpu-pin-default-subtarget.py, which rewrites a bare amdgcn
-mtriple (one with no subarch, which now errors with "cannot codegen
with no subarch") to the subarch triple matching the historical per-OS
default subtarget: amdhsa -> amdgpu7.00 (gfx700), everything else ->
amdgpu6.00 (gfx600). Only RUN lines without an explicit -mcpu are
touched; lines that name a CPU are fold cases left to the triple
migration tooling.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
utils/AMDGPU: Add target-cpu attribute migration script
Add amdgpu-migrate-test-target-cpu.py, which migrates tests that set the subtarget via a uniform "target-cpu" IR function attribute into the amdgpu subarch triple: it folds the cpu into the RUN-line triple (or strips the attribute when the triple already encodes it), and removes now-empty attribute groups and their references. Handles both .ll and .mir (indented attribute defs).
Co-Authored-By: Claude <noreply at anthropic.com> (Claude-Opus-4.8)
utils/AMDGPU: Handle --mcpu/--mtriple double-dash in migration script
The migration helper only matched the single-dash -mcpu/-mtriple spelling. Some tests use the GNU-style --mcpu/--mtriple form; handle both so those RUN lines fold correctly instead of being mangled.
Co-Authored-By: Claude <noreply at anthropic.com> (Claude-Opus-4.8)
AMDGPU: Convert tests to use subarch from triples in the file
This set was using target triple in the source rather than command
line arguments.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
clang/AMDGPU: Forward host system includes in offload compiles
Commit 640079288c5e merged the AMDGPU toolchain subclasses but dropped the
HIPAMDToolChain::AddClangSystemIncludeArgs override, which forwarded to the
host toolchain.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>