Skip to content

merge main into amd-staging - #4588

Closed
ronlieb wants to merge 82 commits into
amd-stagingfrom
amd/merge/upstream_merge_20260923074528
Closed

ronlieb wants to merge 82 commits into
amd-stagingfrom
amd/merge/upstream_merge_20260923074528

Conversation

@ronlieb

@ronlieb ronlieb commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

ldionne and others added 30 commits September 22, 2026 20:38
…225501)

The benchmark uses std::strlen but never includes <cstring>.
Previously, we would build GoogleBenchmark against the just-built
library, not against the library being tested. When testing historical
versions of libc++ or other standard libraries, this breaks. So instead
of building Google Benchmark against the just-built library in CMake, do
it from Lit as part of the test suite's configuration.

I'm not a huge fan of using Lit as a poor man's build system and we
should make the CMake test suite self-contained, however this is a step
in the right direction and it removes a major coupling between the test
suite and the regular libc++ build.
Add option [no]mark-plt to enable it. Dynamic linker can change PLT
entries with JMPABS instruction on supported targets.

Ref.:
https://maskray.me/blog/2021-09-19-all-about-procedure-linkage-table#x86-plt-rewriting

Assisted-by: Claude Sonnet 4.6

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
…#211757)

Currently the atomic optimizer creates reductions via intrinsics,
and introduces new control flows.
Replace this sub-target dependent logic with the existing
wave reduction intrinsics, which get lowered in the backend.
This patch ports the uniform-value and divergent-no-return-value cases.
To port the divergent-with-return-value cases, additional scan intrinsics
will need to be added.
…vm#217859)

This patch extends intrinsic `DefaultValue` auto-upgrade to overloaded
intrinsics.

---------

Signed-off-by: DharuniRAcharya <dharunira@nvidia.com>
Adds Windows page size detection for ORC-RT using GetSystemInfo.

Also updates the process-info regression coverage into a single test
…225567)

This ensures the undef/poison value is always nan-boxed. This is
important if the value ends up being used by a freeze. If the value
isn't properly nan-boxed, it will be treated as a nan in FP contexts
regardless of its lower bits. If the freeze is also cast to an integer,
the lack of nan-boxing will be noticed and the integer will see the real
value of the lower bits.

Fixes llvm#225455.
3648582 was supposed to make this test more generic, but
accidentally removed it instead.

Reconcile the dropped changes with 3648582, which added page-size
checking.
…25274)

This is a new checker that requires a Borrow<T> when using a
pointer/reference/view that is lifetimebound to a CanBorrow type.

A CanBorrow type is a type that tracks views into its interior at
runtime, and calls crashIfBorrowed() when it invalidates such views.
Vector is the motivating example.

A design description is available at:
https://github.com/WebKit/WebKit/wiki/SaferCPP:-Borrowed-Pointer-Use-After-Destruction

I implemented UnborrowedLocalVarsChecker in terms of the existing
alpha.webkit.*LocalVarsChecker system because the requirement to hold an
overlooking smart-pointer-like-thing is pretty similar.

In some cases where the new checker is stricter than the existing
checker, this patch conditionalizes the strictness. The plan is to
upgrade existing checkers in a follow-up patch.

Assisted-by: Claude
Ports llvm/Testing/Support/Error.h to orc_rt: EXPECT_THAT_ERROR and
ASSERT_THAT_ERROR, EXPECT_THAT_EXPECTED and ASSERT_THAT_EXPECTED, and
the Succeeded, Failed, Failed<InfoT>, FailedWithMessage and HasValue
matchers.

Two departures from the original. An orc_rt Error carries at most one
ErrorInfoBase -- there is no joinErrors -- so the holder keeps a single
error, FailedWithMessage takes one matcher rather than a variadic pack,
and FailedWithMessageArray is dropped. ErrorInfoBase has
dynamicRTTIName, so a type mismatch names the type that did turn up
rather than reporting only that the expected one was absent.

Header-only, under test/unit with the other test helpers rather than in
a shipped testing library. ErrorMatchersTest exercises each matcher
against a matching and a non-matching value, the latter through gtest's
failure interception.
Match ld-prime by listing synthesized Objective-C message-send stubs in
Mach-O map files, including their final addresses and mode-specific sizes.
This PR contains the fix for the `readability-identifier-naming` crash.
The crash happens because the checker calls `hasMemberName` on a base
class without checking if that base class actually has a definition
first (like when it's just forward-declared). I added a
`RD->hasDefinition()` guard to fix it.

Fixes llvm#213948
This allows reusing the same build script for the PR benchmark and
the historical benchmarking jobs. This also opens the door to adding
new configurations where the library isn't rebuilt (e.g. where the
artifacts are pulled from a pre-built location, or even testing against
non-libc++.

Assisted by Claude
init_tls, cleanup_tls, and set_thread_ptr are per-thread routines used
by both Thread::run in libc.a and main-thread startup in crt1.o, but
tls.cpp was previously only merged into crt1.o. Linking libc.a without
crt1.o (such as a self-contained shared library statically linking
libc.a, or an executable built with -nostartfiles) failed with undefined
hidden symbols when thread.cpp.o was pulled in.

Move {x86_64,aarch64,riscv}/tls.cpp from libc/startup/linux/ to
libc/src/__support/threads/linux/ alongside tcb.h (matching prior
migrations of auxv and program_invocation_name from startup into src so
dependencies flow from startup -> src). Expose them via a forwarding
ALIAS target libc.src.__support.threads.linux.tls depended on by both
thread and do_start, and remove tls from merge_relocatable_object(crt1).

Mark init_tls with [[gnu::flatten]] and compile tls with
${libc_opt_high_flag}. Once tls.cpp.o is in libc.a rather than first on
the link line inside crt1.o, an earlier object compiled with
-fstack-protector-strong can otherwise win COMDAT selection for
LIBC_INLINE helpers (e.g. linux_syscalls::getrandom) in -O0 builds and
read %fs:0x28 before set_thread_ptr initializes the thread pointer.

Change AppProperties app in libc/config/linux/app.h from extern
[[gnu::weak]] (which resolved to NULL without crt1.o) to
LIBC_INLINE_VAR, providing a COMDAT-deduplicated .bss definition shared
by crt1.o and libc.a, matching auxv::value.

Assisted-by: Automated tooling, human reviewed.
Adds Windows virtual-memory support for ORC-RT
Also adds a small Windows error helper that converts GetLastError()
results into ORC-RT Error values with the corresponding system message.
Turns back on all the memory tests for windows.
Previously, this was applying the offset it would for non-null pointers,
but null pointers should always cast to a null pointer result.

Fixes llvm#224869
Use the Error matchers introduced in 72aeee3 to clean up error checks
in ConnectionSpecTest.
…m#225384)

This commit reverts 3500668/llvm#225111,
reapplying 9028ff1/llvm#224257. It fixes an
error in risc-v assembly (forgot to adjust for constant renaming).

The original commit message was:

This patch implements an internal clone syscall wrapper and uses it both
to implement the public clone(2) entry point and to spawn new threads in
libc's thread implementation.

Previously, thread creation in thread.cpp invoked the raw SYS_clone
syscall directly, requiring target-specific inline assembly or register
variables and subtle tricks with __builtin_frame_address to pass
arguments to start_thread in the newly spawned thread.

By introducing an inline assembly clone wrapper that sets up func and
arg on the child stack and jumps to the entry function upon clone
returning in the child, we can simplify start_thread to a normal
function taking a single void * argument and eliminate the frame pointer
hacks as well as the need to compile thread.cpp with
-fno-omit-frame-pointer or optimizations.

The public clone(2) entrypoint delegates to this wrapper after unpacking
its varargs and validating pointers (returning EINVAL like glibc).

A particularly tricky aspect of this patch is the invalidation of the
cached thread IDs. As with fork(), we do this in the parent, but we
cannot do this safely for clone() in all situations. The problematic
case is where the user does not set a custom TLS block (which means the
child uses the parent's block), does not clone the address space (no
copy-on-write), and does not suspend the parent (vfork semantics). In
this case, we just give up and don't touch the thread ID. For this
particular flag, most of the operations in the child are not safe, so
we're assuming the user is prepared for such a restricted environment.

Support is implemented for x86_64, aarch64, and riscv. The
architecture-specific assembly is split out into detail::clone_impl
inside per-architecture headers.

Assisted-by: Gemini
Support for omp dispatch and omp dispatch nowait in flang.

-----
Sunil Kuravinakop (koops@hpe.com)
…5415)

This switches Clang to use the API introduced in
llvm#224652. This produces
getelementptr constant expressions in canonical ptradd form.
Previously this relied on the TargetABI MCOptions field and ignored
the IR flag.

Co-authored-by: Claude (Claude-Opus-4.8) <noreply@anthropic.com>
Concatenate the known bits of both halves, with operand 0 as the low
half and operand 1 as the high half, matching
TargetLowering::SimplifyDemandedBits and GlobalISel's G_MERGE_VALUES.
Add missing #include <deque> to SimpleRemoteCAOverSocket.cpp to fix
compile errors on Linux.
…lvm#218909)

The bitwise OR of different enum types resulted in many C++20
deprecation warnings in the generated option tables:

     warning: bitwise operation between different enumeration types
     ‘llvm::opt::DriverVisibility’ and
     ‘clang::options::ClangVisibility’ is deprecated
     [-Wdeprecated-enum-enum-conversion]

Fix by emitting casts to `unsigned`, matching the types of the
corresponding fields in `OptTable::Info`.
…lvm#224533)

We reuse isCFMulFromFMSUBADD from llvm#222896 to fold vfmsubadd into vfcmulc.
As a result using this pattern-match in combineFaddCFmul becomes
redundant as it (c += a * ~b) still becomes vfcmaddcph through the
existing fadd + vfcmulc combine.
The indentation in this entire code block was off-by-one, which
incremental clang-format can't handle, so reformat the whole
section.
charles-zablit and others added 20 commits September 23, 2026 11:53
…ests (llvm#224305)

`api/multithreaded` and `api/multiple-debuggers` build a C++ driver
against the SB API. Both were skipped on Windows with `"clang-cl does
not support throw or catch (llvm.org/pr24538)"`, which is no longer what
stops them. Two things do: the drivers fail to compile because
`common.h` and `multi-process-driver.cpp` include `<unistd.h>`
unconditionally, and once they compile they run on a different CRT than
`liblldb.dll`: the gnu-style clang driver links
[`libcmt`](https://github.com/llvm/llvm-project/blob/main/clang/lib/Driver/ToolChains/MSVC.cpp)
unless `-fms-runtime-lib=` is passed, so the driver gets the static CRT
while `liblldb.dll` gets the DLL one.

Fixes:

- Include `<direct.h>` and `<io.h>` instead of `<unistd.h>` on Windows,
and get the working directory with
[`_getcwd`](https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/getcwd-wgetcwd?view=msvc-170).
- `get_working_dir` returns a `std::string` now.
- `test_stop-hook.cpp` uses `_pipe`/`_fdopen` on Windows, and closes the
pipe streams instead of the descriptors they were opened over, write end
first so the interpreter's I/O thread sees EOF.
- Guard the `<unistd.h>` include in `multi-process-driver.cpp`.
- `buildDriver` passes `-fms-runtime-lib=dll` (`dll_dbg` for a Debug
build) and drops the `libcmt` the driver adds at the link step.

`test_breakpoint_location_callback` stays skipped, for an unrelated
reason: `BreakpointCreateByName` with `eFunctionNameTypeFull` resolves
no location in a PDB build, while `eFunctionNameTypeAuto` resolves one.
Tracked in llvm#224303.

rdar://177435499
…lvm#224635)

This patch widens selected operands of the product calculation to
`size_t`/`uint64_t` to prevent multiplication overflow when a 64-bit
data size or offset is being calculated. This fixes a number of issues
reported by a CodeQL scan.
…vm#225078)

I spotted recently that when attempting to compile a function with an
early exit loop we don't emit any remarks when we fail to vectorise due
to possible faulting loads. This PR fixes that and other missing
remarks, plus I've also added missing tests for some cases where we fail
to vectorise early exit loops.

For the remarks, I've used debug information to uniquely identify the
remark and associate it with a particular function.

Tests were assisted by Codex (GPT 5.5)
Adds codegen for the following AMDGCN s_prefetch builtins:

- __builtin_amdgcn_s_prefetch_data
- __builtin_amdgcn_s_prefetch_inst

These are lowered to the corresponding `llvm.amdgcn.s.prefetch`
intrinsics.

Assisted by: Claude Opus 5

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Accept the six block-scaled MX types in TOSA 1.1 draft compliance
checks. Preserve REVERSE on constant value splats whose block scales can
differ; reversing a unit dimension remains a no-op.

Cover supported types, version and extension requirements, invalid
shapes and axes, and block-scaled canonicalization.

Signed-off-by: Peng Sun <peng.sun@arm.com>
…25685)

ORC_RT_TEST_DLL_EXPORTS was already defined in the previous block.
…c symbol list (llvm#225495)

`__ubsan_install_trap_loop_detection` passed an un-initted ` sigaction`
to `sigaction(SIGPROF, ...)`, with garbage in `sa_flags` and `sa_mask`
(such as setting `SA_RESETHAND`, blocking `SIGILL`, and omitting
`SA_SIGINFO`).
This PR fixes it by zero-initialising sigaction 

Two other drive-by cleanups:
- set `SA_SIGINFO | SA_RESTART` because ITIMER_PROF fires SIGPROF
periodically. Without SA_RESTART, any blocking syscall (read, write,
waitpid, etc.) interrupted by a periodic SIGPROF tick would spuriously
fail with EINTR instead of transparently resuming after SigprofHandler
returns.
- pass `EXTRA ubsan.syms.extra` to
`add_sanitizer_rt_symbols(clang_rt.ubsan_loop_detect ...)` in
`CMakeLists.txt` so `libclang_rt.ubsan_loop_detect.a.syms` is not
generated as an empty `{ };` dynamic list (which causes a syntax error
with GNU `ld.bfd`).
There is no reason to run this for changes to other projects/runtimes.
…with multiple users (llvm#210460)

Extend getCastInstrCost to recognize cast absorption into widening
instructions (uaddl, saddw, urhadd, etc.) when the cast has multiple
users, not just one.

Previously, the check only looked at a single user (`I->hasOneUser()`),
so a zext/sext feeding more than one widening-eligible instruction was
always costed as non-free, even when every user could individually
absorb it.

This also affected codegen: `optimizeExtendOrTruncateConversion` in
`AArch64ISelLowering.cpp` decides whether to lower a double-widening
zext via tbl shuffles based on whether `getCastInstrCost` reports the
cast as free. With multi-user casts always costed as non-free, this
took the tbl-lowering path in cases where every user could actually
absorb the cast for free, generating unnecessary tbl instructions.

Compiler Explorer:
- Current Assembly: https://godbolt.org/z/hG7oe5h5M
- Expected Assembly: https://godbolt.org/z/EE6xnaxoG

This change factors the per-user check out into
`getUserAbsorbedCastCost()` and applies it across all users of the
cast. The cast is only treated as free if every user can absorb it;
the reported cost is the max of the per-user absorbed costs, to stay
conservative when a partial-widening cost (Src->Src*2) applies for
some user.

Tests:
- free-widening-casts.ll: new cost-model cases with multiple absorbing
  users. These cases had a cost of 1 without this change.
- zext-to-tbl.ll: new codegen coverage showing tbl is no longer
  generated once the cast is correctly recognized as free.
llvm#225669)

…5106)"

This reverts commit b0d31f4.

This missed the restriction that ORDERED is not allowed when DISTRIBUTE
is a constituent construct.
CMakeList.txt was updated in
llvm#225495
Add the linux_syscalls::pause wrapper using SYS_ppoll, along with the
unistd pause entrypoint and unit test on Linux.

Assisted-by: Automated tooling, human reviewed.
Setting a watchpoint on an SBValue variable should not trigger after the
life time of the variable. because a new frame can reuse the same
address for a different variable.

Set the name of the variable as the watch spec.
I noticed this when trying to debug some failures, the Python log are
missing responses when compared to the C++ log.

Change the test case suffix `testcase` from `test_dap` to avoid
confusion with a session log (`dap{session_number}.log`).
@ronlieb
ronlieb requested review from a team and dpalermo September 23, 2026 12:47
@rocm-cciapp

rocm-cciapp Bot commented Sep 23, 2026

Copy link
Copy Markdown

Note

CCI merge-inner bisection finished

Started 2026-09-23 13:15 UTC. This comment is updated about once an hour.

Status

Elapsed 1h 30m
Inner commits 81
Probes so far 5
Verify compiler-runtime · gfx94X-dcgpu
Failed check Linux::release / Build Multi-Arch Stages / compiler-runtime / Stage - Compiler Runtime (github-actions)
Result bisection summary
Good merge / first parent 536ce77888ab
Bad merge 8adeb359d546

Probe timeline so far (newest → oldest)

Inner SHA Result
70/81 b05fbd416a24 FAILverify-build
69/81 9f5238db368d FAILverify-build
68/81 60b069f41351 FAILverify-build
67/81 34152bb7d2f3 PASSverify-build
66/81 5bb2e21c30de PASSverify-build

Likely culprits (intelligent first pass)

Searching inner window 66/81 … 70/81 first (5 commits), then the full range if that does not bracket the failure.

Rank Inner SHA Score Subject
1 68/81 60b069f41351 48 [mlir][tosa] Add MXFP support for REVERSE (llvm#225058) (PR llvm#225058)
2 49/81 21f2cf952ccc 27 Reland "[mlir][SPIR-V] Verify NonPrivatePointer requirement for MakePointer{Available,Visible}" (llvm#213621) (llvm#225499) (PR llvm#213621)
3 44/81 0b8d78f0eadf 16 [Github] Register Flang integration test check in issue comment workflow (llvm#225500) (PR llvm#225500)
4 46/81 309ae98474b6 15 [clang][NVVM][NVPTX] Remove pzo modifier for rs rounding mode conversions (llvm#225012) (PR llvm#225012)
5 42/81 e56c2cefc3e7 15 [IR] Remove llvm.strip.invariant.group intrinsic (llvm#225399) (PR llvm#225399)

Top match because: mlir in PR title, test in changed paths, dialect in changed paths.

@rocm-cciapp

rocm-cciapp Bot commented Sep 23, 2026

Copy link
Copy Markdown

Warning

First bad inner commit: 60b069f41351
[mlir][tosa] Add MXFP support for REVERSE (#225058)

Do not merge this branch.

CCI merge-inner bisection

Culprit 60b069f413518552eb755d8b07082eb5dbf5bbfd
Last good inner 34152bb7d2f3
Good merge / first parent 536ce77888ab
Bad merge 8adeb359d546
Verify compiler-runtime · gfx94X-dcgpu
Failed check Linux::release / Build Multi-Arch Stages / compiler-runtime / Stage - Compiler Runtime (github-actions)
Inner commits 81
Probes 5

Culprit details

60b069f413518552eb755d8b07082eb5dbf5bbfd
[mlir][tosa] Add MXFP support for REVERSE (#225058)

Probe timeline (newest → oldest)

Inner SHA Result
81/81 9aace93cb4c5 not probed (excluded by bisection)
80/81 a68d1990c7a7 not probed (excluded by bisection)
79/81 bc9276a5e093 not probed (excluded by bisection)
78/81 3bd7ee0215b7 not probed (excluded by bisection)
77/81 d86a3c5b18f7 not probed (excluded by bisection)
76/81 141a9763fff5 not probed (excluded by bisection)
75/81 869e02f41245 not probed (excluded by bisection)
74/81 1d1284d83ac2 not probed (excluded by bisection)
73/81 945b9128ca66 not probed (excluded by bisection)
72/81 03fb798b28c2 not probed (excluded by bisection)
71/81 2b14a195cd76 not probed (excluded by bisection)
70/81 b05fbd416a24 FAILverify-build
69/81 9f5238db368d FAILverify-build
68/81 60b069f41351 FAIL
67/81 34152bb7d2f3 PASSverify-build
66/81 5bb2e21c30de PASSverify-build
65/81 a3a45508d77c not probed (excluded by bisection)
64/81 37e2844bc468 not probed (excluded by bisection)
63/81 7a3edbfbcf4a not probed (excluded by bisection)
62/81 a4a3c487251e not probed (excluded by bisection)
61/81 80a1eaf320f2 not probed (excluded by bisection)
60/81 8022a985db5a not probed (excluded by bisection)
59/81 d56ee7ad2a41 not probed (excluded by bisection)
58/81 ae88993db5db not probed (excluded by bisection)
57/81 8026eba98cb3 not probed (excluded by bisection)
56/81 21ca7b6617bb not probed (excluded by bisection)
55/81 6f6f737a6a5c not probed (excluded by bisection)
54/81 4cd2f4d84b36 not probed (excluded by bisection)
53/81 9b979d298716 not probed (excluded by bisection)
52/81 6f4f74487d0d not probed (excluded by bisection)
51/81 0bf45de5d6df not probed (excluded by bisection)
50/81 9e09b11ae67f not probed (excluded by bisection)
49/81 21f2cf952ccc not probed (excluded by bisection)
48/81 f4084fbccabf not probed (excluded by bisection)
47/81 023687b8531d not probed (excluded by bisection)
46/81 309ae98474b6 not probed (excluded by bisection)
45/81 65f27d8ebd9d not probed (excluded by bisection)
44/81 0b8d78f0eadf not probed (excluded by bisection)
43/81 c41e1ef6e1cc not probed (excluded by bisection)
42/81 e56c2cefc3e7 not probed (excluded by bisection)
41/81 7ecac8052859 not probed (excluded by bisection)
40/81 0ceb8668fa90 not probed (excluded by bisection)
39/81 942114858fd1 not probed (excluded by bisection)
38/81 6e47e8fb1eb3 not probed (excluded by bisection)
37/81 febf4155e985 not probed (excluded by bisection)
36/81 62ea87e542c3 not probed (excluded by bisection)
35/81 7fdffde1a3a9 not probed (excluded by bisection)
34/81 a91921eda070 not probed (excluded by bisection)
33/81 c0590ce37393 not probed (excluded by bisection)
32/81 b176c11a5e77 not probed (excluded by bisection)
31/81 75225e049964 not probed (excluded by bisection)
30/81 3661bf5f8b28 not probed (excluded by bisection)
29/81 fba082229072 not probed (excluded by bisection)
28/81 685e2b1b1231 not probed (excluded by bisection)
27/81 5e5e63dfc728 not probed (excluded by bisection)
26/81 b313739c9538 not probed (excluded by bisection)
25/81 d8aecd0b3ff6 not probed (excluded by bisection)
24/81 f47c2807a4d2 not probed (excluded by bisection)
23/81 d88a7a003f0c not probed (excluded by bisection)
22/81 e0416baf412b not probed (excluded by bisection)
21/81 07baaf981515 not probed (excluded by bisection)
20/81 34d1f71c636d not probed (excluded by bisection)
19/81 bad56e4022e1 not probed (excluded by bisection)
18/81 2dea059adc9a not probed (excluded by bisection)
17/81 d34026a71c20 not probed (excluded by bisection)
16/81 926b5e99cf68 not probed (excluded by bisection)
15/81 6506e7380c7f not probed (excluded by bisection)
14/81 4057f8e45b7f not probed (excluded by bisection)
13/81 20bc398ee734 not probed (excluded by bisection)
12/81 85fca8f1f491 not probed (excluded by bisection)
11/81 f5f1fd6fc00b not probed (excluded by bisection)
10/81 4c8a437d0487 not probed (excluded by bisection)
9/81 081cc091b902 not probed (excluded by bisection)
8/81 72aeee3df11d not probed (excluded by bisection)
7/81 fa43610d6929 not probed (excluded by bisection)
6/81 3648582c0a41 not probed (excluded by bisection)
5/81 82732028dc61 not probed (excluded by bisection)
4/81 20e7308dbc1b not probed (excluded by bisection)
3/81 7f8640b7bdab not probed (excluded by bisection)
2/81 1bfe9893f3dc not probed (excluded by bisection)
1/81 932884869113 not probed (excluded by bisection)
Bisect metadata

@ronlieb ronlieb closed this Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.