Skip to content

merge main into amd-staging - #5112

Merged
ronlieb merged 32 commits into
amd-stagingfrom
upstream_merge_202610241842
Oct 25, 2026
Merged

ronlieb merged 32 commits into
amd-stagingfrom
upstream_merge_202610241842

Conversation

@z1-cciauto

Copy link
Copy Markdown
Collaborator

No description provided.

jsji and others added 30 commits October 24, 2026 10:49
…lvm#235305)

The test added by aa6e40c checks for named values
(entry:, %x.addr, %x), which only appear when clang keeps value names.
That is the default in assertion builds, but non-assertion CI builds
discard them, so the CHECK-NEXT: entry: line fails. Pass
-fno-discard-value-names explicitly.

Assisted-By: Claude Opus 5.5
…lvm#233771)

Extracted from llvm#231423

`PatternApplicator` debug printing was unconditionally calling
`getDumpRootOp` which walks nested ops chains. This was taking a
noticeable time in synthetic 1000-nested test. Call `getDumpRootOp` only
if printing is actually enabled.
llvm#226577)

[clang-tidy] Don't suggest const on std::moved locals in templates

Skip diagnostics in template instantiations for locals that are used as
arguments of std::move.
Reason: for some instantiations the move may be converted to copy so the
variable may look unmutated and flagged, whereas for other template
instantiations the real move semantics may apply.

Fixes: llvm#225395

Assisted by Gemini for constructing the matcher.

---------

Co-authored-by: Zeyi Xu <zeyi2@nekoarch.cc>
… inside the pad body (llvm#223712)

`DropPadUnitDims` reused the pad's padding value as-is when building the
replacement `tensor.pad`.
If that value was defined inside the original pad's own body, the new op
ended up referencing it from outside its region, and erasing the
original pad then hit an assertion.

This PR clone the defining op when the padding value lives inside the
pad body.

Fixes llvm#203813

---------

Signed-off-by: Federico Bruzzone <federico.bruzzone.i@gmail.com>
…dABSToABD. (llvm#235129)

Do the cheaper hasOperation checks first
It will eventually be legalized to a splat_vector and constant, but we
usually use a vector getConstant so let's be consistent.
…ction-branch (llvm#234733)

When the default of a switch is unreachable, SelectionDAGBuilder elides
the jump table range check, except when ARM branch-target-enforcement is
enabled, since an unchecked table branch can be a JOP gadget.

Extend this to the cf-protection-branch module flag used by RISC-V
Zicfilp and X86 IBT. The module flag is merged with Module::Min
behavior, so a value of 0 is treated as not enabled.

Assisted-by: Claude
…ef (llvm#235307)

After an allocation failure, cleanupFailedDefs added each failed def to
the live ranges of all regunits of the assigned register. A subregister
def only writes the subregister, so the remaining units got a def from
an instruction that does not modify them, which the verifier rejects.

Fixes ran-out-of-registers-errors.ll with EXPENSIVE_CHECKS after
llvm#233796.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…at scratch (llvm#235258)

Mesa shaders always had s[0:1] reserved for the implicit buffer
pointer, which is only needed to set up the scratch buffer
resource. With architected flat scratch, scratch is initialized by the
hardware and the pointer is unused. The driver stopped passing this
pointer so all user SGPRs were off by 2.

Don't reserve it on targets with architected flat scratch, so the user
SGPRs of Mesa shaders start at s0. Diagnose the use in the unsupported
contexts. This fixes many test failures on my system when running
piglit.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
)

In a bootstrapping build, flang is only built for the runtime's build
step, but not the configure step. That means the the result of Fortran
compiler introspection is unreliable. Don't attempt
`check_fortran_builtins_available()` in a bootstrapping configure.

One may think that any compiler introspection will just fail as intended
if flang is not even available, but
llvm#209482 (comment)
describes how it may pass: `fakeflang` just runs the preprocessor (which
is sufficient for CMake to detect LLVMFlang), but
`check_fortran_builtins_available`'s check is intended to fail during
symbol resolution.
This removes `Passes/BundleVec/AMDGPU/` as there are no tests left in
this directory after llvm#234432
This pass followed the anti-pattern of having a cl::opt in the pass
which early returned instead of not adding the pass to the pipeline in
the first place.  Additionally several targets had their own cl::opts
used from the subtarget enablement hook.

Consolidate this into one generic control with a subtarget hook to
enable the pipeliner, following the example of enable-misched /
enableMachineScheduler.

Adding the nop pass still had the side effect of running the required
analyses which exposed issues. In particular this hides failures in
PPC with the defaults. The LiveIntervals dependency would assert if
there were unreachable blocks which was possible with the point PPC
inserted the pass.

Hexagon's hardware loop passes move to the end of
addMachineSSAOptimization so they still run before the pipeliner.

This preserves the existing target specific opt level checks in the
subtarget hook, though that means opt level disablement doesn't get
the same benefit. I'm assuming these choices are arbitrary and we can
just pick one opt level for all targets in the future.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ns.td (llvm#235180)

Move -propeller-match-bbid and -propeller-infer-threshold from cl::opt
in BasicBlockMatchingAndInference.cpp to CodeGenOptions.td. This avoids
exposing PropellerMatchBBID in BasicBlockMatchingAndInference.h and
including that header in TargetPassConfig.cpp.
…ng_new (llvm#234856)

On AArch64 (AAPCS64), Clang lowers `struct __sized_ptr_t { void *p;
size_t n; }` as `[2 x i64]` (`llvm::ArrayType`), whereas on x86_64 it is
lowered as `{ ptr, i64 }` (`llvm::StructType`).

Additionally, `emitHotColdSizeReturningNew` and
`emitHotColdSizeReturningNewAligned` in `BuildLibCalls.cpp` previously
hardcoded `StructType::get(B.getContext(), {B.getPtrTy(), SizeTTy})` as
the return type of the newly emitted `_hot_cold` call, which would fail
`replaceAllUsesWith` when replacing a call returning `[2 x i64]`.

Assisted-by: Gemini Argon
…35329)

M68k is failing on the bots. I'll need to fix it or waive the broken
node, but I need time to investigate.

Reverts llvm#235157
…m#235232)

PointerUnion::dyn_cast has been soft-deprecated in favor of
llvm::dyn_cast and llvm::dyn_cast_if_present.  This patch replaces
PointerUnion::dyn_cast with llvm::dyn_cast at 17 call sites across 11
files under clang/.

All tests in check-clang pass with these changes, and LLM-based static
analysis of the surrounding data structures and call sites confirms that
the PointerUnion operand at each site is nonnull either by construction
or because callers ensure it is nonnull before reaching llvm::dyn_cast.

Assisted-by: Antigravity
…35233)

The last callers of GEPOperator::countNonConstantIndices were removed
on April 26, 2024 in commit cbe1760.

Assisted-by: Antigravity
…229754)

As we revert a wls loop to a dls loop, we remove the t2WhileLoopStartLR
to a t2DoLoopStart at the start of the preheader. In finding the
t2WhileLoopStartLR we might have looked through a copy that is still
using the t2WhileLoopStartLR def. Make sure we replace the use with the
Src to remain valid.

Fixes llvm#229400
…lvm#235089)

A structured `acc declare deviceptr(a)` inside a procedure lowers to an
`acc.declare_enter` whose data operands include the deviceptr op, but
the matching `acc.declare_exit` carried no operands for it. The runtime
therefore saw the region opened at the enter and never closed, and the
entry registered for `a` survived the end of the procedure. With a dummy
argument this leaks one present table entry per call.

Append the deviceptr entry ops to the `acc.declare_exit` operands in
`genDeclareInFunction`, the same way the present clause is handled. No
copyout or delete is generated for deviceptr. The runtime conversion
then emits the data end call for the exit.

The lowering test checks that the exit names the deviceptr object and
that no delete is produced.
…221946)

Updated `nanf128`, `getpayloadf128`, `setpayloadf128`, and
`setpayloadsigf128` for emulated `float128`, including shared headers,
entrypoints, CMake/Bazel dependencies, wrappers, and tests.

closes llvm#221574
…me via getDeviceLibs (llvm#218528)

Add support for linking `libclang_rt.builtins.bc` for the `spirv64`
target at compile time by integrating it into the SYCL `getDeviceLibs`
mechanism. This ensures built-in runtime library functions are available
for SYCL device code targeting `SPIR-V` 64-bit.

Re-land of llvm#212550 (Only Clang
Driver changes)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
…lvm#234613)

VPReplicateRecipe::execute clones the original instruction, carrying
over all metadata & attributes.

Clear poison-generating attributes & metadata, to make sure we only
apply the attributes & metadata carried by the recipe itself.

PR: llvm#234613
Follow-up to llvm#229921 to
slightly simplify the code.
Related: llvm#179278.

This patch adds host-side registration support for CUDA built-in surface
references in CIR.

Previously, CIR recognized CUDA surface variables during registration,
but host-side surface handling was not implemented. This change
preserves the surface type information in CIR registration metadata and
emits the corresponding `__cudaRegisterSurface` runtime registration
call.

## Changes

- Internalize CUDA surface and texture host shadow variables to match
original CodeGen behavior
- Extend `CUDAVarRegistrationInfoAttr` with the CUDA surface type
- Extract the surface type from the CUDA surface template arguments
during CIRGen
- Add `__cudaRegisterSurface` runtime declaration and call generation in
`LoweringPrepare`
- Keep texture runtime registration explicitly NYI
- Add host-side CIR and LLVM test coverage for surface registration
- Check generated LLVM registration against original CodeGen behavior

## Testing

- `git diff --check`
- `clang/test/CIR/CodeGenCUDA/surface.cu`
- `ninja -C build -j1 clang`
`REAL(10)` is only available on x86 targets. x86-registered-target
enabled in llvm#235068 is insufficient, it also needs to be compiled to the
x86 target triple. Apply the same -triple as other tests such as
flang/test/Semantics/real10-x86-01.f90 do.

Note: Some constant foldings are only available if the flang compiler
itself runs under x86, but folding is not what is tested here.

Should fix the
[clang-aarch64-sve-vls-2stage](https://lab.llvm.org/buildbot/#/builders/4)
buildbot
The WindowScheduler clones the loop body into TripleMBB and advances the
base registers of memory accesses to later iterations, but the clones
keep the original iteration's memory operands. The per-window scheduler
could therefore treat a store and a load from different copies as
non-aliasing and reorder them, even though they touch the same address
in consecutive iterations, producing wrong code.
Detect loop-carried memory dependences on the original loop and enforce
them with a DAG mutation while list scheduling each window.
Fixes llvm#209946
…vm#235339)

The std::unique_ptr reference was mostly cargo-culting from clang/flang
that does not necessarily make sense for other frontends (case study
right now is rustc). Change to a raw_pwrite_stream given that makes more
sense internally and gives frontends more flexibility.
@z1-cciauto
z1-cciauto requested a review from jhuber6 as a code owner October 24, 2026 22:42
@z1-cciauto
z1-cciauto requested a review from a team October 24, 2026 22:43
@ronlieb
ronlieb merged commit 2ec747d into amd-staging Oct 25, 2026
107 of 108 checks passed
@ronlieb
ronlieb deleted the upstream_merge_202610241842 branch October 25, 2026 01:02
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.