Commit Graph
588345 Commits
Author SHA1 Message Date
Michael Kruse b24ef7e132 [Polly][test] Add missing REQUIRES line (#210578)
The test was added by #201859. It's test uses --debug-only which
requires an LLVM_ENABLE_ASSERTIONS-build

(cherry picked from commit 5cae63bd0d31118a15481fc7e5b063a73492d77d)
2026-07-23 16:17:26 +02:00
Shikhar Jain 2acc07fb43 [Polly] Guard ISL ast gen compute out (#201859)
Bounds the maximum ISL operations allowed for ISL AST Generation.

Fixes: https://github.com/llvm/llvm-project/issues/201801
(cherry picked from commit 790882669323c7255cb761755bb2d37d3b344452)
2026-07-23 16:17:26 +02:00
Med Ismail Bennani 493aab374f [lldb/script] Remove verbose comments following c4962f5721a3 (NFC) (#210827)
This removes verbose comments from c4962f5721a3 following a post-merge
comment.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
(cherry picked from commit e6cde20367a82aca112db73a3d1c76e77fe580f1)
2026-07-23 08:09:07 +02:00
Med Ismail Bennani 938bba16d3 [lldb/script] Only auto-open the generator template in an editor when interactive (#210808)
`scripting extension generate` always launched the external editor after
writing the template to disk, which is fine when a user types the
command at the prompt but is undesirable when the command runs from the
test suite, a headless driver, or a script -- each invocation spawns an
editor that nobody sees.

Extend `--open-editor` (`-e`) so that the default (`eLazyBoolCalculate`)
now dispatches on `CommandReturnObject::GetInteractive()`, which
`SBCommandInterpreter::HandleCommand` explicitly clears. That's the
accurate signal even when the process' stdin is a TTY inherited from the
parent (e.g. `lldb-dotest` invoked from a terminal). `--open-editor yes`
and `--open-editor no` still force the behavior explicitly.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
(cherry picked from commit 3d0f18b6210e8cbc9fa04bca91581e25371c5b14)
2026-07-23 08:09:07 +02:00
Med Ismail Bennani 3df0bbdc25 [lldb/script] Add scripting extension template generator (#209647)
This patch adds a `scripting extension generate <ExtensionType>...`
command that introspects a Python extension base class and emits a
skeleton subclass with `# TODO: Implement` stubs for its abstract
methods (or, with `-a`, every method), then opens the result in an
editor.

Generated imports use `from <module> import <class>`, and the generated
`__init__` forwards its arguments to `super().__init__(...)` since every
base class relies on its constructor to set up attributes
(`self.target`, `self.process`, ...) that inherited, non-overridden
methods depend on. When the host can't open an external editor (e.g.
non-macOS), the command reports that as a message rather than an error,
since the file is already written.

To catch regressions in the generator itself instead of just checking
that a file was produced, this patch adds
`TestScriptingExtensionGenerate.py`, which generates a template for
every extension kind on the fly and drives it through a live lldb
session (`process launch -C`, `breakpoint set -P`, `target stop-hook add
-P`, etc.).

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
(cherry picked from commit c4962f5721a36e198234019b846d3788738f766a)
2026-07-23 08:09:06 +02:00
Med Ismail Bennani e28ea20ce0 [lldb/script] Migrate frame recognizers onto ScriptedPythonInterface (#209805)
Give `frame recognizer add -l` a formal
ScriptedStackFrameRecognizerInterface, matching the architecture already
used by ScriptedProcess, ScriptedBreakpoint, etc.: a C++ interface
header, a Python-backed implementation built on
ScriptedPythonInterface's CreatePluginObject/Dispatch machinery,
PluginManager registration, and a generatable Python ABC template
(scripted_stackframe_recognizer.py).

get_recognized_arguments' documented contract returns a plain list of
lldb.SBValue (not an lldb.SBValueList), so it bypasses the generic
Dispatch<ValueObjectListSP>() extractor and calls the SWIG bridge
directly, matching the legacy behavior exactly.

ScriptedStackFrameRecognizer now holds a single interface object created
once in its constructor and reused across every RecognizeFrame() call,
same lifecycle as before.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
(cherry picked from commit a07b91d8243b8a8051dbbe5739eacc7942269c61)
2026-07-23 08:09:06 +02:00
Med Ismail Bennani 694db4d296 [lldb/script] Add type hints to scripted extension base classes (#209680)
This patch adds type annotations to every method (parameters and return
types) and every `self.<name>` attribute of the scripted extension base
classes shipped under `lldb/examples/python/templates/`. Extension
authors reading the base classes -- or an IDE navigating them -- can now
see the `lldb.SB*` contract each method exposes without having to
cross-reference the docstring.

`scripting extension generate` also picks the annotations up: derived
class docstrings advertise each inherited attribute together with its
declared type, and the generated method signatures carry their parameter
and return annotations too.

The classes covered are `ScriptedProcess`, `ScriptedThread`,
`ScriptedFrame`, `PassthroughScriptedProcess`,
`PassthroughScriptedThread`, `ScriptedFrameProvider`,
`ScriptedBreakpointResolver`, `ScriptedThreadPlan`, `ScriptedHook`,
`ScriptedPlatform`, and `OperatingSystem`.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
(cherry picked from commit f10ede511119d7f31f2c6aaca3cbcb1ea00164ce)
2026-07-23 08:09:06 +02:00
Med Ismail Bennani c1ee0469a2 [lldb/script] Improve scripting extension list output and filtering (#209400)
This patch improves `scripting extension list` in three ways.

First, it groups the output by `ScriptedExtension`: instead of one row
per registered plugin instance, one entry per extension is printed with
a combined `Language` field.

Second, it colorizes and visually separates the output. Each entry is
preceded by a dimmed dashed separator; field labels are printed in bold
green, the extension name value in bold cyan as a mini-heading, and
`None` usage values are dimmed, all via the same
`ansi::FormatAnsiTerminalCodes(..., use_color)` idiom
`Breakpoint::GetDescription` uses elsewhere, gracefully no-op when color
is disabled or unsupported. `ScriptedInterfaceUsages::Dump` takes an
optional `use_color` parameter so its own `API Usages:` / `Command
Interpreter Usages:` labels can match.

Third, it adds `-j`/`--json` to emit a JSON array of `{name,
description, languages, api_usages, command_interpreter_usages}` per
extension, mirroring `plugin list`'s existing `-j`. `DoExecute` now
computes the extension grouping once and branches into
`OutputJsonFormat` or `OutputTextFormat`, sharing a
`GetLanguagesForExtension` helper. It also accepts optional positional
`<extension-name>` arguments to filter the listing to specific
extensions (matched via the same case-insensitive
`ScriptInterpreter::StringToExtension` used by `scripting extension
generate`), with completion wired up via `eScriptedExtensionCompletion`.

Also fix a latent lifetime bug in the shared language-collection helper
so it owns its `std::string` values instead of holding `StringRef`s to
temporaries; the JSON path made it observable.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
(cherry picked from commit 514b75bbc54f751abdcd32f118f620c3dd2ce4ae)
2026-07-23 08:09:06 +02:00
Xing Xue 62d4ad9d04 [libunwind][AIX] Handle VAPI-based return addresses in stack unwinding for LLU (#209280)
In AIX's implementation of LLU (Live Library Update), the caller of a
Virtual API (VAPI) interface instead calls VAPI glue and the
implementation for a VAPI function is entered from the VAPI glue. If a
VAPI is not already active on the thread, the VAPI calls the
implementation of the VAPI function with the link register (LR) value
set to a return address in the VAPI glue. In this case, the LR (return
address) value on entry to the VAPI glue is saved in the VAPI control
block. This PR checks whether the return address in a stack frame falls
within the VAPI address range. If it does, the unwinder retrieves the LR
value from the VAPI control block and uses it as the return address
during stack unwinding. In addition, before transferring control to a
landing pad, this PR executes the VAPI return glue to clear the VAPI
control block if the VAPI glue was used.

---------

Co-authored-by: Hubert Tong <hubert.reinterpretcast@gmail.com>
(cherry picked from commit 8aa808457c6aeba25ec0e17139c3fcab59923c3c)
2026-07-23 08:06:55 +02:00
Florian Hahn 6a8bec8771 [Matrix] Use incoming terminator as insert point in visitPHI. (#211211)
For some instructions, like invoke, getInsertionPointAfterDef may return
an std::nullopt. Using the insert point after the phi is then incorrect.
Use the incoming terminator as default insert point to fix a crash in
the added test cases.

PR: https://github.com/llvm/llvm-project/pull/211211
(cherry picked from commit 8c556564a2199e13f59dc43bfa5ef4345a89ae3b)
2026-07-23 08:06:15 +02:00
Yuxuan Chen b570122870 [Clang][coro] Fix coro.free in .resume clones with [[clang::coro_await_elidable]] (#207799)
Fixes https://github.com/llvm/llvm-project/issues/188230

CoroAnnotationElide rewrites annotated safe calls to the `.noalloc`
variant. The noalloc frame is caller-owned, but its `.resume` clone is
shared with ordinary heap-allocated instances.

With a `suspend_never` final suspend, normal resumption falls through to
the `coro.free` deallocation path. Regular frontend cleanup has already
run before this point. `coro.free` must therefore produce the frame
pointer for a heap instance and null for a `.noalloc` instance.

Use the frame destroy slot as a per-instance allocation tag. Cache its
value at resume entry, before user code can resume and release the
enclosing caller frame, then compare it with the cleanup clone. Replace
each `coro.free` result with the frame pointer for a heap instance and
null for an elided instance.

Update the CoroSplit and Clang CodeGen checks to cover the conditional
deallocation and the original suspend_never final-suspend shape.

Assisted-By: Codex GPT 5.5
(cherry picked from commit b9e3e6546dcb4b33d023b7a336163d5650cda9d4)
2026-07-23 08:05:05 +02:00
Daniil Kovalev fe4580e97f [PAC][libc++] Fix build with ptrauth_calls feature (#211033)
After partial revert of #208330 in #209928, the libcxx build started
failing because of missing `<cstdint>` include required for `uintptr_t`
declaration used only by code behind `ptrauth_calls` feature check. See
https://lab.llvm.org/buildbot/#/builders/227/builds/3358

This patch adds the missing include.

(cherry picked from commit 12e1c7f70f34d59c023d05d0fe2c228a4e9aac11)
2026-07-23 08:04:13 +02:00
Alexander Kornienko 3eed3d7f35 Revert "[Clang] Rebuild lambda captures in default member initializers while skipping body (#196597)" (#211001)
This reverts commit 50f30bedaa. The commit
causes a crash in clang:
https://github.com/llvm/llvm-project/pull/196597#issuecomment-4997866573

(cherry picked from commit 150aa53d48aa6fdde26e00ea118582eb949f0dca)
2026-07-23 08:03:10 +02:00
Adrian Prantl 32eed90cb8 [lldb] Fix Unicode code point formatting to use proper notation (#211131)
- use uppercase hex digits

- only emit "U+" notation for valid code points (<= U+10FFFF),
zero-padded to a minimum of four digits.

rdar://173817553

Assisted-by: claude
(cherry picked from commit 0cd942fa1b6de94fd6d7fa7ba73f0233293115f8)
2026-07-23 07:56:02 +02:00
Ben Dunbobbin 5910053397 [DTLTO] Forward loop interchange to DTLTO remote compilations (#208591)
Recent upstream LLVM changes enabled `LoopInterchangePass` by default
through `PipelineTuningOptions`. TLTO observes that state directly from
the LTO config, but DTLTO was not forwarding the equivalent Clang option
to the remote compiler. As a result, TLTO could run loop interchange
pass while DTLTO did not, producing codegen differences for
configurations that exposed profitable/legally interchangeable loops.
Note that this was a pre-existing issue, the change in default has
simply exposed it.

Forward `C.PTO.LoopInterchange` as `-floop-interchange` when
constructing the common DTLTO remote compiler options. Extend the
testing to check that the SN-DBS remote command line includes the
forwarded option.

The code for forwarding such options is only intended as a temporary
measure. A more comprehensive solution is in discussion here:
https://discourse.llvm.org/t/synchronizing-lto-code-generation-configuration-between-clang-and-lld-dtlto

(cherry picked from commit 49d568a8d60d5912a5a7d8b2c3ac1caf58dab3e6)
2026-07-23 07:54:04 +02:00
Ben Dunbobbin bb709cbce5 [DTLTO] Add remote compiler option forwarding coverage (#208589)
Add a cross-project DTLTO test that checks the existing LTO
configuration state serialized into the remote Clang command line. The
test uses the validate.py distributor to inspect the generated DTLTO
JSON.

Cover all the existing forwarded options.

Add paired negative checks for optional flags so the test also verifies
they are not emitted when the corresponding configuration state is not
set.

(cherry picked from commit c012610ab9924f465baea5e62397056ea9594567)
2026-07-23 07:54:04 +02:00
AntonyCJ30 af1bc1ffc4 [X86] Fix swapped VPTERNLOG231_imm8/VPTERNLOG312_imm8 SDNodeXForm bodies (#209782)
Fixes #157929

VPTERNLOG231_imm8 and VPTERNLOG312_imm8 had their bodies swapped,
causing ISel to emit the wrong truth-table immediate whenever operand
reordering was needed (-O1+, not -O0).

Test changes:
- **avx512-vpternlog-commute.ll: regenerated with
update_llc_test_checks.py**
  (accounts for the large diff)
- Added 4 new cases: vpternlog231_rmik, vpternlog312_rmik,
  vpternlog231_rmbik, vpternlog312_rmbik

Tested: llvm-lit on llvm/test/CodeGen/X86 (no regressions), original
repro verified correct at -O0 through -O3, -Os, -Oz.

(cherry picked from commit bd38dd0ace19c3b9512da2b37bb9690ee6c9e97f)
2026-07-23 07:46:37 +02:00
Jonas Devlieghere 5868a854a4 [DWARFLinker] Fix RefTypeName crash and type-table non-determinism (#209033)
The parallel linker computes DIE placement (artificial type unit vs
plain DWARF) concurrently across compile units.

1. updateDependenciesCompleteness checked the placement of the enclosing
root type (getRootForSpecifiedEntry) instead of the actual referenced
DIE. A nested type can be demoted to plain DWARF while its root stays in
the type table, leaving a type-unit DIE that references a plain DIE and
tripping the RefTypeName assertion in
DIEAttributeCloner::cloneDieRefAttr. Carry the actual referenced DIE on
the worklist item and check its placement.

2. The completeness dependency set was recorded as a side effect of the
concurrent marking traversal, which short-circuits on already-marked
DIEs (isAlreadyMarked) before maybeAddReferencedRoots. When a shared
cross-CU DIE was already marked by a racing CU, the current referencing
root's outgoing dependencies were dropped, so the demotion fixpoint
missed demotions and whole type subtrees were left in the artificial
type unit non-deterministically. Add a RecordDepsOnly mode that, on the
short-circuit, re-walks the already-marked subtree and records the
dependencies directly without marking, scheduling, or following
references (so no cycles). This makes the recorded dependency set
complete and order-independent; the demoted-DIE set now matches the
single-threaded result on every run.

rdar://180584698
(cherry picked from commit cdc31cfa66f0b2da2483854db9c783ddba120c42)
2026-07-23 07:44:01 +02:00
Dan Bonachea a8f4b7f316 [flang][docs] Release notes: multi-image updates
Populate flang 23 release notes with multi-image feature updates.
2026-07-23 07:36:18 +02:00
Tom Stellard 63b5d9c311 workflows/release-sources: Add missing checkout for composite action (#211079)
We need to explicitly checkout
.github/workflows/validate-release-version if we are going to use it.

(cherry picked from commit f2a284b4732b2b568315d5b8f2e36a96eed23f8a)
2026-07-23 03:28:06 +00:00
Tom Stellard 0d82a7df33 workflows/release-documentation: Add missing checkout (#211082)
We need to checkout the upload-release-artifact composite action before
using it.

(cherry picked from commit 8ad500f6f7d7347ca097d9c442fbf4a0f604dc26)
2026-07-22 20:33:44 +00:00
Louis Dionne 165c472d65 [libc++] Don't require complete types in vector<T>::empty() (#210754)
This was previously not required, but the patch to introduce a new
size-based vector layout unintentionally added this new requirement. We
almost certainly not want to promise this guarantee going forward, but
we should actually land this change explicitly and consider the
transition story, not do it as a fallout of another refactoring.

Fixes #210732

(cherry picked from commit 17ac8fdd95283110a14f1de8c15a0fc661119296)
2026-07-22 14:06:58 +00:00
jay0x b2628f061e [flang][Lower][OpenMP] Fix reduction on array sections aborting in lowering (#209701)
**Summary**

This regression was introduced by #196094, which added a special
lowering path for reductions on a single array element, such as `a(2)`.

The problem is that Flang also treated an array section like `a(2:96)`
as if it were a single element. Because of this, the section was sent to
a code path that only supports scalar elements.

That path produced an array type that the reduction initialization code
could not handle, so Flang reached a `TODO` and aborted with a “not yet
implemented” error.

**Fix**

The fix is to use the special element path only when the expression has
rank 0, which means it represents one single value. Array sections have
rank greater than 0, so they should continue through the existing
boxed-array path.

Fixes : [209462](https://github.com/llvm/llvm-project/issues/209462)

---------

Co-authored-by: Jay Satish Kumar Patel <kumarpat@pe31.hpc.amslabs.hpecorp.net>
(cherry picked from commit 6c560cddfb1e206678866c6822baabcdcee2343f)
2026-07-22 14:05:29 +00:00
Sudharsan Veeravalli ed059dae03 [RISCV] Avoid forming Zilsd pairs with x0 for non-x0 register classes (#211019)
The pre-RA Zilsd optimizer allowed a pair when both stored values came
from the same virtual register if that virtual register was defined by a
copy from X0. This is only valid when the virtual register class can
actually contain X0.

Check the virtual register class before treating the value as `x0_pair`.
This prevents forming an invalid paired store for register classes such
as `GPRNoX0`.

Without this change we were hitting the following assertion in
`RISCVLoadStoreOptimizer`:

```
assert(
    FirstReg != SecondReg &&
    "First register and second register is impossible to be same register");
```

(cherry picked from commit 6b408bf0da2901a5264a39b7571f5e68b846d94a)
2026-07-22 14:04:40 +00:00
Sudharsan Veeravalli 6c8106221a [RISCV] Support uimm5 operands for Xqcicm cmovs in RISCVExpandPseudoInsts (#210955)
`expandCCOpToCMov` was only accepting signed 5-bit immediates before
forming `Xqcicm` conditional-move pseudos. Valid `uimm5` operands for
unsigned compare forms such as `QC_MVGEUI` and `QC_MVLTUI` were not
being handled leading to a crash.

Track whether the selected conditional-move opcode expects a signed or
unsigned immediate, and validate the RHS against the matching range.

(cherry picked from commit 9bcb851e86941117ec9e82db8986ed301f929647)
2026-07-22 14:04:03 +00:00
Prabhu Rajasekaran 6f033fece5 [llvm-readobj] Print all callgraph sections (#198929)
Ensure that `llvm-readobj` / `llvm-readelf` processes and dumps all
SHT_LLVM_CALL_GRAPH sections present in an object file, rather
than just the first one.

**Motivation:**
Consider this `foo.s` file
```
.pushsection .text, "axG", %progbits, foo
  .globl foo
  foo:
  ret
  .pushsection .llvm.callgraph, "?", %llvm_call_graph
    .byte 0, 0
    .dc.a foo
    .quad 0
  .popsection
.popsection

.pushsection .text, "axG", %progbits, bar
  .globl foo
  bar:
  ret
  .pushsection .llvm.callgraph, "?", %llvm_call_graph
    .byte 0, 0
    .dc.a bar
    .quad 0
  .popsection
.popsection
```
`clang -c foo.s && llvm-readelf --elf-output-style=JSON --pretty-print
--call-graph-info foo.o` on that shows that there is only one record
reported because the current implementation just looked at the first
SHT_LLVM_CALL_GRAPH section and then ignored all others. This patch will
address this gap by iterating over all the SHT_LLVM_CALL_GRAPH sections.

(cherry picked from commit eb7677457c1611c02a6362d9eae043987c02ea25)
2026-07-22 14:03:18 +00:00
John Paul Jepko e23de9497b [analyzer] Fix StdVariantChecker crash on std::get with a non-ptr arg (#210167)
When `std::get` is called on a dereferenced integer-to-pointer cast, the
checker `alpha.core.StdVariant` crashes. Minimal reproducer:

```
std::get<int>(*(std::variant<int, char> *)11);
```

Godbolt reproducer - https://godbolt.org/z/4EKe1PrKb

The root cause is that `StdVariantChecker::handleStdGetCall()` calls
`SVal::getType()` on any non-unknown argument, then calls
`getPointeeType()` on the result while assuming it is a pointer type. In
the case of a concrete integer cast to a pointer and then dereferenced,
it is modeled as `loc::ConcreteInt`, whose recovered type is an integer.
`getPointeeType()` on such an input returns a null QualType, on which
`getTypePtr()` crashes.

Fix the crash by using the argument's static type rather than recovering
its SVal, eliminating the need to guard and call `getPointeeType()`.

(cherry picked from commit accd1ed5226b4a8009c33f0a6d1bcfe58902f69e)
2026-07-22 14:01:46 +00:00
Andy Ames b82e355d1b [analyzer] Fix crash in RegionStoreManager::bindArray from constructor array-to-pointer decay (#210649)
ProcessInitializer() strips implicit casts from a CXXCtorInitializer's
init expression via IgnoreImplicit(), then decides whether to treat the
initializer as a direct array-to-array member copy by checking
Init->getType()->isArrayType(). For a pointer member initialized via
array-to-pointer decay of a reference-to-array constructor parameter
(e.g. `Foo(T (&arr)[N]) : ptr_(arr) {}`), IgnoreImplicit() strips the
ArrayToPointerDecay cast, exposing the underlying array-typed
expression, so this check misfires even though the field itself is a
pointer, not an array. That branch fetches the raw region address of the
whole array, bypassing the normal decay logic (which produces an
ElementRegion), so the pointer member ends up holding the address of the
whole array typed as the array itself, instead of an ElementRegion at
index 0.

Later, dereferencing and storing through that mistyped pointer routes
into RegionStoreManager::bindArray() (instead of bindScalar()), which
unconditionally casts its Init value to nonloc::CompoundVal, asserting
in a debug build and segfaulting in a release build when Init is
anything else, e.g. a nonloc::LocAsInteger produced by round-tripping a
pointer through an integer type.

Fix the actual bug by checking the field's type instead of the
initializer expression's type. Also generalize bindArray()'s existing
guard (added by #178923 for issue #178797) from an enumeration of
specific SVal kinds to the same exhaustive
`!isa<nonloc::CompoundVal>()` check already used by its siblings
bindStruct() and bindVector(), so it doesn't need to be extended again
every time a new SVal kind reaches this path -- this is what actually
catches our case (nonloc::LocAsInteger), which the prior enumeration
didn't cover.

This is the same underlying bug behind #147686 (fixed by #153177, which
its own author noted was "more of a workaround") and #178797 (fixed by
#178923); both those fixes patched symptoms at bindArray() without
addressing the ProcessInitializer() root cause. Fixing the root cause
also resolves two FIXME-annotated precision gaps in
clang/test/Analysis/initializer.cpp's gh147686 regression test.

Fixes #210183

AI tool use disclosure: Claude Code (Anthropic) assisted in reducing the
original crash to a minimal, dependency-free reproducer (via creduce
plus manual bisection, verifying each reduction step against the actual
crash), which informed root-causing this bug in
RegionStoreManager::bindArray and ExprEngine::ProcessInitializer. The
commits made here were drafted with Claude's assistance and reviewed by
me before being pushed. I've reviewed all AI-assisted contributions here
and take full responsibility for the correctness of this change.

---------

Co-authored-by: Andy Ames <andy.ames@joby.aero>
Co-authored-by: Balázs Benics <benicsbalazs@gmail.com>
(cherry picked from commit 5b1fa37be65be730784a675c40b15d5a702f38ab)
2026-07-22 14:01:06 +00:00
Med Ismail Bennani 69873d3d19 [lldb] Gate PolicyStack::Current() log behind verbose (#209527)
`Process::GetState()` calls `PolicyStack::Get().Current()` on every
prompt redraw, so the previous unconditional LLDB_LOG at the read site
fired on every keypress once `log enable lldb process` was on, drowning
out any other process log output. Keep the dump for when it's actually
wanted, but only fire it if the log is set to verbose.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
(cherry picked from commit c7a0afe5049a3d4789f34a8d746c6a45d73557b4)
2026-07-22 14:00:22 +00:00
David Green 37532c319a [SDAG] Use DAG.getTokenFactor in more places (#210949)
This will cause the TokenFactor to be split into nodes of at most
SDNode::getMaxNumOperands() size.

This fixes #189161 but I have not added a test case as the output is
in excess of 160000 lines long.

(cherry picked from commit ba836590ffed1305a770fc18f4a3f676f9829df1)
2026-07-22 13:59:33 +00:00
Yanzuo Liu 2f8eaf6ef0 [clang][Parser] Warn when the body of expansion statement is not a compound statement (#209229)
<https://eel.is/c++draft/stmt.expand#nt:expansion-statement>:

_expansion-statement_:
template for ( _init-statement<sub>opt</sub>_ _for-range-declaration_ :
_expansion-initializer_ ) _compound-statement_

(cherry picked from commit d13b8625eef0941f48b5af74e9fab953b6430eb2)
2026-07-22 13:58:49 +00:00
Brian Cain a94ef18355 [docs][Hexagon] Add 23.x release notes for Hexagon changes (NFC) 2026-07-22 13:58:05 +00:00
Jonas Devlieghere 2462eac065 [DWARFLinker] Make synthetic type names deterministic under threading (#209553)
(cherry picked from commit 6bcdcb39c57ea926d3082ec3ecae74bf59b4658e)
2026-07-22 13:57:20 +00:00
Jonas Devlieghere e241e1868b [DWARFLinker] Fix data race on the per-unit file-name cache (#208967)
CompileUnit::getDirAndFilenameFromLineTable reads and mutates the unit's
FileNames DenseMap without synchronization. During the parallel
type-name assignment phase a unit's cache is touched both by its own
worker and, through cross-unit type-name references
(addReferencedODRDies calling addDieNameFromDeclFileAndDeclLine) by
other units' workers.

The concurrent find/insert/grow corrupts the map and trips the
assertion:

```
Assertion failed: (TheBucket), function findBucketForInsertion, DenseMap.h
```

Guard the cache with a mutex. Store each entry in a heap-allocated pair
so the StringRefs handed back to callers stay valid across a concurrent
rehash. Otherwise a short (small-string-optimized) file name would move
when another insertion grows the map, dangling a StringRef already
returned.

(cherry picked from commit 499b69cf07e03a23a420ee773261fcfcfc1c3df9)
2026-07-22 13:56:45 +00:00
Petr Hosek 881e1cb719 [libcxx][NFC] Address -Wmicrosoft-cast in MSVC's exception_ptr (#210570)
This was introduced as part of #94977. Rather than suppressing the
warning with `#pragma clang diagnostic ignored`, we use
`reinterpret_cast` to avoid the implicit conversion.

(cherry picked from commit 16ffd27e3737c01cbabad6eed77b919dc977ad6c)
2026-07-22 13:56:05 +00:00
Mikołaj Piróg 2d5e67002c [X86] Support apxf in attribute target (#184078)
As in title. This adds support for using apxf in attribute target.
Individual features are not supported for FMV but are supported for
enabling a feature for the function

Patch done with usage of Claude Code.

(cherry picked from commit 1d55a816c6dddfaacfd39f3235519a2389b56423)
2026-07-22 13:55:19 +00:00
Simon Pilgrim 2cb2b2979c [X86] combineShiftRightLogical - fold srl(vecreduce_umax(x),bw-1) as MOVMSK signbit reduction (#210281)
VectorCombine may have folded:
  icmp_eq(vecreduce_or(splatsign(x)),0) --> icmp_sgt(vecreduce_umax(x),-1)

which DAG folds to:
  srl(vecreduce_umax(x),bw-1).

This match attempts to lower:
  srl(vecreduce_umax(x),bw-1) --> icmp_ne(movmsk(x),0) "any_of negative"
  srl(not(vecreduce_umax(x)),bw-1) --> icmp_eq(movmsk(x),0) "none_of negative"

The correct fix would be to improve vecreduce_or costs to prevent
VectorCombine doing this, but that change is far too big to be merged
into 23.x - so I've created the narrow backend fix.

Fixes #209714

(cherry picked from commit 8abc26930cf9ee0f059228acdbd1d22cd1c325e3)
2026-07-22 13:54:32 +00:00
Antonio Frighetto c22ddf0f40 [MemCpyOpt] Ensure call slot optz does not lower destination alloca alignment
A destination alloca's alignment could have been unconditionally
overwritten, letting a lower-aligned source incorrectly undo a
previous alignment increase. This issue has been addressed by
considering the maximum alignment between the new source target
and current destination, adhering to what the existing comment
already promises.
2026-07-22 13:53:52 +00:00
Jacob Crawley 7bd74c15be [AArch64][LV] Adjust costs for low-VF interleaved access (#209441)
Addressing regression introduced by #205844 in which a significantly
slower SVE tail loop is generated.

The cost model for the case where the interleave factor is larger than
the VF has been adjusted to more accurately reflect the cost of the uzp
instructions generated by the deinterleave tree, and the cost of
legalizing the type of each subvector.

(cherry picked from commit 79e05f4aff2e5b9f0513c0539d146e44cc80193c)
2026-07-22 13:53:14 +00:00
Logan 2ca1deea15 X86: Add pattern for optimized BLSIC IR form (#209814)
Add DAG pattern to recognize the optimized IR form of BLSIC: (xor (and
x, -x), -1)

Fixes #209718 - matches the IR form produced after InstCombine
optimizations

Added tests for both 32-bit and 64-bit BLSIC patterns

Assisted by: Claude Code, helped me understand
pattern-matching/intrinsics, and some file structure. As well as how
testing for LLVM works.

(cherry picked from commit 466503dcf2ae2e43126c1a6d8a5b204883d5b0c1)
2026-07-22 13:52:29 +00:00
Patryk Stefanski a82f94b8f4 [clang][sema] Fix crash on decomposition decl missing initializer (#210151)
ActOnUninitializedDecl dereferenced the std::optional<Token> from
Lexer::findNextToken() unconditionally when diagnosing a structured
binding with no initializer. Guard the optional and fall back to the
declaration's location.

(cherry picked from commit 0e3852f73ab75639b76bad2c8a735d46241768f3)
2026-07-22 13:51:49 +00:00
Tony Guillot 9a93aaef36 [Clang] Fixed auto parsing regression with brace initialization (#210347)
The PR #208552 has introduced a regression where brace initialization
was not taken into account `auto foo{12}`. It was also breaking
`dcl.type.general` p2 rules, which is also now tested.

(cherry picked from commit d592aa5a10f44164cd403257270802eb2a4b123a)
2026-07-22 13:51:11 +00:00
Jacek Caban 201044ab88 [LLD] [COFF] Fix linking directly against an ARM64X DLL without import library (#210311)
In mingw mode, when linking against a DLL, the user can either provide a
regular import library, or provide the actual DLL. When linking against
an ARM64X image, add both native and EC views to the symbol table on EC
targets. Also getMachine() on such images returns ARM64X, treat it as
ARM64 instead.

(cherry picked from commit 30f270edb42c5d37e4c4a413ebfc7a6513565b30)
2026-07-22 13:49:12 +00:00
Petr Hosek 521b0ff9a6 [libc++] Partially revert #208330 (#209928)
We found out that the new mechanism for detecting overriden functions
does not support Arm Pointer Authentication (PAuth). Addressing this
limitation is going to require changes to Clang. In the meantime, we
switched back to the old mechanism when PAuth is enabled.

(cherry picked from commit db7356dde8312a86e79ec0d7b7f844878a1a743c)
2026-07-22 13:48:33 +00:00
Jacek Caban feb77ff813 [CodeGen][ARM64EC] Copy first four arguments to FP registers in vararg exit thunks (#209581)
ARM64EC vararg functions receive all types of the first four arguments
in x0-x3. Because x86_64 expects floating-point arguments in FP
registers, always copy x0-x3 to d0-d3 in the exit thunks, matching
MSVC's behavior.

(cherry picked from commit 9c6a9f5fa37ffc21d4561301772bc600bd344d4c)
2026-07-22 13:47:16 +00:00
David Green 9e6077709b [AArch64] Lower fixed width bf16 fpround (#209411)
Similar to #209194, this was previously hitting an error with an illegal
FP_ROUND_MERGE_PASSTHRU. This time we lower the fptrunc to a scalable
fptrunc and let it legalize naturally. On SVE systems a f64->bf16
fptrunc will fail to legalize, but lowers successfully with sve2 with
fcvtn. A store(fptrunc) -> truncstore combine was disabled too as it
fails with bf16.

(cherry picked from commit 50f2b9443d23eba757c3c0f42eef71e0f9721b15)
2026-07-22 13:46:34 +00:00
Daniel Paoliello 71ee1456b2 [clang][win] Fix __global_delete wrappers for Arm64EC and cross-TU ::delete (#209585)
PR #188372 made Clang's MSVC-ABI deleting-destructor path route global
deletes
through compiler-generated __global_delete / __global_array_delete
wrappers
instead of referencing ::operator delete directly. This lets a deleting
destructor be emitted in environments (e.g. kernel mode) where no global
::operator delete exists: each wrapper defaults to a trapping
__empty_global_delete fallback, and a real forwarding body that calls
::operator delete is materialized only when the program actually uses
::delete.

This change refines how those wrappers and their fallbacks are emitted,
fixing
two problems that made the #188372 mechanism fail in practice.

New behavior:

- The trapping fallback is now emitted as a weak GlobalAlias to
__empty_global_delete rather than via an /alternatename directive. This
lowers
to a COFF weak-external-with-default -- exactly what MSVC emits -- so a
real
__global_delete defined in any TU overrides the fallback in every other
TU at
  link time.

- A ::delete expression now registers the wrapper for its resolved
global
operator delete directly (in EmitCXXDeleteExpr), so the strong
forwarding body
is emitted in that TU regardless of where the class's deleting
destructor is
defined. This matches MSVC, which emits the forwarder at every ::delete
site.

Bugs fixed:

1. Arm64EC (miscompile -> LNK2019). /alternatename only names the plain
symbol,
not the backend-generated "$$h" hybrid EC symbol referenced by the exit
thunk, so Arm64EC images left __global_delete$exit_thunk unresolved. The
weak
GlobalAlias correctly produces the "$$h" symbol, exit thunk, and plain
alias
   (verified on both x64 and Arm64EC).

2. Cross-TU ::delete (runtime crash). Previously the forwarding body was
only
emitted in a TU that *both* emitted a matching vector deleting
destructor and
contained a ::delete. A TU that only performed `::delete p` -- with the
class
defined elsewhere -- emitted no forwarder, so nothing overrode the
weak-alias
trap and the program executed a trapping __empty_global_delete at
runtime
(STATUS_ILLEGAL_INSTRUCTION). Registering the wrapper at the ::delete
site
   fixes this.

To share wrapper-creation logic between the deleting-destructor path and
the
delete-expression path, getOrCreateMSVCGlobalDeleteWrapper is promoted
from a
static helper in CGClass.cpp to a CodeGenModule method.

Verified end-to-end: a weak alias in one TU and a strong forwarder in
another
resolve to the forwarder under both lld-link and MSVC link.exe, and the
previously-crashing delete-only TU now runs cleanly.
2026-07-22 13:45:45 +00:00
Younan Zhang 5deccad341 [Clang] Ensure correct template parameter depth for abbreviated templates (#209693)
This fixes another case of member functions where we overlooked template
depths when only abbreviated template parameters are involved.

This mirrors previous fix cfb25203c2, but I don't intend to put it in
ParseTrailingRequiresClause because we might want the similar fix for
e.g. noexcept expressions, so let's keep it inline for future refactor.

The example comes from #205557.

(cherry picked from commit 3485d8591992a967553493c53f17d9f3e8a0fc8e)
2026-07-22 13:44:41 +00:00
Eli Friedman 2cff4ff7a2 Make ios_base::xalloc non-atomic with LIBCXX_ENABLE_THREADS=OFF. (#208356)
762b77a moved the definition of "xindex" out of the header, and in the
process dropped the _LIBCPP_HAS_THREADS check. Re-add the check to
maintain the status quo.

The discussion on https://github.com/llvm/llvm-project/pull/198994
indicates it's not clear whether LIBCXX_ENABLE_THREADS=OFF is actually
supposed to mean single-threaded. But it clearly does in practice:
atomic_support.h uses non-atomic ops when threads are disabled, and a
few other APIs have explicit non-atomic fallback paths.

My team ran into this trying to run libc++ tests for a RISC-V core
without the "a" extension.

(cherry picked from commit 3eb929be5e17d66900020bd1caa7d2510d4f9601)
2026-07-22 13:43:38 +00:00
aokblast a36edf659e [Clang][Interpreter] Don't pass -fPIC on MSVC (#210507)
(cherry picked from commit 617e4f54e503b54b08445a086d95a80aa72a58d0)
2026-07-22 13:42:45 +00:00