Skip to content

[pull] main from llvm:main - #1665

Merged
pull[bot] merged 43 commits into
MPACT-ORG:mainfrom
llvm:main
Jul 22, 2026
Merged

[pull] main from llvm:main#1665
pull[bot] merged 43 commits into
MPACT-ORG:mainfrom
llvm:main

Conversation

@pull

@pull pull Bot commented Jul 22, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

firmiana402 and others added 30 commits July 22, 2026 14:01
Update LLVM's DWARF language tables to match the current
[`DW_LANG_*`](https://dwarfstd.org/languages.html) and
[`DW_LNAME_*`](https://dwarfstd.org/languages-v6.html) registries.

Add the missing `DW_LANG_*` and `DW_LNAME_*` constants, update the
corresponding language-version mappings, and expose the new `DW_LANG_*`
codes through the LLVM C API.
…gment (#206817)

Introduce a new `PseudoProbeLinker` in `dsymutil` that collects
`__probes/__probe_descs` sections from the debug map objects and merges
the sections and places the probes metadata under
`Contents/Resources/Profiling/{pseudo_probes[-<arch>],pseudo_probe_descs[-<arch>]}`
respectively.
The [DWARF language registry](https://dwarfstd.org/languages.html)
defines the default array lower bound for `DW_LANG_Fortran18` as one,
but LLVM records it as zero. Update the language table to match the
registry.
)

RISCVISelDAGToDAG's lowering of RISCVISD::LPAD_CALL / LPAD_CALL_INDIRECT
to PseudoCALLLpadAlign / PseudoCALLIndirectLpadAlign (introduced in
#177515) only copied the callee, lpad label, chain, and glue operands,
dropping the argument-register and register-mask operands in between.

Without the register-mask operand, the register allocator treats these
calls as clobbering nothing but ra, so values live across the call are
not spilled/reloaded even though the callee is free to clobber
caller-saved registers. This caused a miscompile where a pointer held
live across a call to getcontext() (a returns_twice function) was
corrupted after the call returned, leading to a SIGSEGV in
llvm-test-suite's siod test.

Fix the operand copy to include the argument-register and register-mask
operands, matching the pseudo-instruction operands of a regular
PseudoCALL/PseudoCALLIndirect.

Signed-off-by: Jerry Zhang Jian <jerry.zhangjian@sifive.com>
a04f87f merged with some debug print
leftovers. This patch removes them.
getLoopDepth is itself an O(depth) parent walk.
…ass (#211174)

Just move it from pipeline to isel pass, NFC.
PerThreadAllocator, only used by DWARFLinker, indexes a fixed
getThreadCount()-sized array by `getThreadIndex()`, so it only works on
ThreadPoolExecutor threads (and asserts elsewhere). It false-shares
adjacent threads' bump pointers.

Instead, create each thread's sub-allocator lazily on first use, keyed
by a process-unique instance id in a thread-local cache, with the
instance owning the heap-allocated sub-allocators. This drops the
getThreadIndex()/getThreadCount() dependence, unblocking the caller
participation change for `parallelFor`.

mlir::ThreadLocalCache solves the same problem by keying a per-thread
map on the instance pointer and reclaiming a thread's slot when an instance
dies, but costs a map lookup and shared_ptr bookkeeping per allocation; instances
here are few and short-lived, so an id-indexed vector is cheaper. The counter
behind claimPerThreadAllocatorId is defined out of line in Allocator.cpp
so Windows DLLs cannot duplicate it and alias two instances' sub-allocators.

Aided by Claude Fable 5
Profiling sqlite on aarch64-O3 shows ~0.5% of compile-time is spent in
the SMEAttrs constructor, mostly from the inliner's areInlineCompatible
and getInlineCallPenalty hooks.

SMEAttrs does 14 string attribute lookups. Invert this to instead walk
the function attributes once and build the mask with a StringSwitch.

Improves CTMark geomean -0.20%, sqlite -0.40%.

https://llvm-compile-time-tracker.com/compare.php?from=4aa1590ad66a1bff9b3c74b4a2c7366473015b4c&to=37796f0f92101225e2fb5b6924acfdb5cba1b672&stat=instructions%3Au

Assisted-by: codex
…#210713)

- builtins with documentation
- instructions
- new subtarget feature only for gfx13
- GlobalISel RegBankLegalize rules
- tests
…cross binops (#211115)

As discussed on #210948 - the "Op(shuffle(V1, Mask), shuffle(V2, Mask))
-> shuffle(Op(V1, V2), Mask)" fold should only occur in InstCombine if
the shuffle is "like for like" and not length changing.

Leave the more general fold to an upcoming VectorCombine patch which can
handle the cost:benefit analysis, including multiuse shuffles.
Sub-dword args are widened to an i32 load whose extra bits belong to a
sibling kernarg or padding, so noundef on the original arg does not
cover the full loaded value

Only copy it when the load type matches the argument type, mirroring the
existing range/nofpclass guards
…onBlocks` (#210950)

Problem
-------
Under -mmlir --wrap-unstructured-constructs-in-execute-region, branch
lowering hit a null Evaluation::block for body statements inside an
OpenMP loop. genMultiwayBranch tripped

Bridge.cpp: Assertion `block && "missing multiway branch block"' failed

and genFIR(SelectCaseStmt) tripped

    Bridge.cpp: Assertion `e->block && "missing CaseStmt block"' failed

The wrap machinery decides an unstructured DO/IF is wrappable and stops
propagating its isUnstructured flag to the enclosing OpenMPConstruct.
The OMP construct's isUnstructured stays false, so the top-level
createEmptyBlocks treats it as a structured directive with nested
evaluations — it allocates only the OMP construct's first-nested block
and does not recurse into the DO body. Then OMP loop lowering takes
over the body via createEmptyRegionBlocks, which was written to
*re-parent* pre-existing blocks into its region and silently skipped
evals whose .block was still null. Body targets (e.g. label 17's
ContinueStmt, or a SelectCase's CaseStmts) therefore had no block when
the consumer read evalOfLabel(...).block, tripping the asserts.

Solution
--------
Restore the invariant that consumers of eval.block can trust it at
lowering time. In createEmptyRegionBlocks (DirectivesCommon.h), when an
eval has isNewBlock but no .block, create one in the current region
alongside the existing re-parenting path. The OMP lowering path then
finds pre-allocated blocks for the whole body — matching the state that
existed before the wrap feature changed isUnstructured propagation —
without any lazy-allocation logic at consumer sites.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
https://alive2.llvm.org/ce/z/dCmoVn

In a GEP comparison with the same base like

    %1 = gep i8, @base, i64 a
    %2 = gep i8, @base, i64 b
    %cmp = icmp ... %1, %2

When we know that the offsets cross the base's alignment boundary the
same
number of times, it means that either both of them will overflow, or
none of
them will. In these cases we can turn the comparison into offset
comparison:

    %cmp = icmp ... a, b
…way (#205564)

As mentioned in #205562, there are cases where the transformation stage
in LoopInterchange stops partway through, and the output IR ends up
partially modified rather than interchanged. Notably, the interchange is
recognized as having succeeded internally even in such cases. Apparently
this happens not to cause any miscompiles at the moment, but it is
clearly dangerous.

This patch removes the early exit in the transformation phase. We cannot
simply remove it, which checks for the presence of a unique successor of
the inner loop header, because there is a case where the header actually
has multiple successors. To avoid that situation, this patch changes the
code to call SplitBlock on the inner loop header unconditionally.

The test changes fall into two categories: some are simply due to newly
added redundant BBs. In the others, the expected interchanges are now
applied as intended, whereas previously the transformation failed and
the interchanges were not applied before this patch.
Prototyping a new minimal type-based approach to RegBankSelect (#199040)
for compile-time purposes exposed various gaps in instruction selection
when not using the existing RegBankSelect pass. These manifested as new
fallbacks when compiling the IR dataset from [1].

This patch teaches instruction selection to handle extracts of scalar
i8/i16/i32 into GPR directly. This will prevent new fallbacks being
introduced when a new type-based RBS pass is added.

The test cases are extracted from [1].

Assisted-by: codex

[1] https://davemgreen.github.io/gisel.html
…209130)

These benchmarks are expected to run for a very short time, and
`{Pause,Resume}Timing` should only be used when operations are expected
to take a long time. Removing them reduces the amount of noise in these
benchmarks.

Fixes #208719
Drop the Scenario dataclass as it is now clear what we are testing for.
In C, an array name in an expression "decays" into a pointer to its
first element. LLDB did not honor this: commands like `memory read
my_array` did not work correctly, because an aggregate type has no
scalar value, so trying to obtain one (ResolveValue/GetValueAsUnsigned)
failed.

This MR adds explicit array decay: for array-typed expressions, the
address of the array object itself is used instead of its (non-existent)
scalar value.
…197437)

Previously, the LangRef was ambiguous about the sign of comparisons used
to create the loop dependence masks. This resulted in the expansion not
following the intended semantics for extreme inputs.

For example, %ptrA = 0, %ptrB = UINT_MAX, should result in a (RAW) mask
with all lanes active. However, previously we'd do ``(%elementSize *
lane) < abs(%ptrB - %ptrA)``, which due to incorrectly using signed
arithmetic would result in a mask with a single lane active as
``abs(%ptrB - %ptrA)`` resulted in 1, not `UINT_MAX`. In other words,
``abs(%ptrB - %ptrA)`` should be ``unsigned-absolute-difference(%ptrA,
%ptrB)``.

Follow up to #188248.
…ock result (#209796)

Previously, when the result of a try-lock call is branched on more than
once, the paths between the branches would disagree on whether the
capability is held while remaining consistent at each branch. The analysis
then gave a false positive warning at the intermediate join:

    mutex 'lock' is not held on every path through here

Create getTerminatorTrylockCall() helper from getEdgeLockset(); if the terminator
of a block branches on the result of a call to a try_acquire_capability-function
(perhaps negated or stored in a local variable), this helper returns that call and
its callee.

Use this new helper in getTerminatorTrylockCaps(), which will return the
capabilities acquired by a trylock; feed these capabilites to intersectAndWarn()
during a branch join, in order to avoid false positives.

Soundness is preserved because intersectAndWarn() still removes the
capabilities from the join block's entry lockset, ensuring any guarded access
inside the join block before the terminator is diagnosed. getEdgeLockset()
then re-adds the capability on the success edge.

This change resolves the false positive warning reported in [1].

Reported-by: https://lore.kernel.org/linux-fsdevel/20260714181057.667977-1-timday@thelustrecollective.com/ [1]
Assisted-by: AI was used a bit to understand the code and to help with testing and validation
…10571)

`replaceWithAdditionalYields` only appends loop-carried values, so
preserve the loop's discardable attributes, matching `scf.for`.

Assisted-by: OpenAI Codex gpt-5.6-sol max
…wering (#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](#209462)

---------

Co-authored-by: Jay Satish Kumar Patel <kumarpat@pe31.hpc.amslabs.hpecorp.net>
)

When PHI-translating a load address through a select of module-level
constant expressions, the folded side becomes a global constant whose
use-list spans multiple functions. Scanning that use-list for an
available cast could return a cast from another function, which then
made DominatorTree::dominates() query a block from a different function
and trip an assertion.

This patch restricts the search to casts in the current function,
matching the existing guards on the GEP and add paths.

Fixes #211034
da-viper and others added 13 commits July 22, 2026 11:32
GetDirectory() returns a StringRef now which doesn't convert to bool
implicitly
Add header generation support for langinfo.h, including nl_item type
definition, langinfo macros, and YAML header specification.

* libc/include/llvm-libc-types/nl_item.h: Define nl_item type
* libc/include/llvm-libc-macros/langinfo-macros.h: Define POSIX macros
* libc/include/langinfo.yaml: Define langinfo.h interface
* libc/include/langinfo.h.def: Header template
* libc/config/linux/*/headers.txt: Enable langinfo header for Linux

Assisted-by: Automated tooling, human reviewed.
Lowers unpredicated stores of scalable vectors that are two or four
times the width of a legal SVE type to multi-vector operations when
subregister liveness is enabled instead of splitting them.

This matches the existing approach for multi-vector load lowering.
…1163)

This restriction dates back to the initial implementation of CoroElide
support
(dce9b02),
but the rationale for treating ramp functions specially seems unclear
and lacks test coverage.

This patch proposes that we drop the restriction and enable more
optimization opportunities. This also fixed the repro in #148380, but
the root cause remains unresolved.
…alects (#205990)

Following #164562 where
RaiseWasm was introduced.
This PR completes the support for rewriting the currently supported Wasm
MLIR operators to arith, math, cf and memref.

---------

Co-authored-by: Ferdinand Lemaire <ferdinand.lemaire@woven-planet.global>
The Phabricator committing-a-change anchor no longer resolves since
Phabricator has been discontinued, so drop the reference and keep the
GitHub Issues guidance for linking reviewed/closed bugs.
Adds codegen support for the block and system-scoped NVVM atomic
builtins: add, and, or, xor, min, max, inc and dec.

These are lowered to the corresponding CIR `cir.atomic.fetch` operations
and subsequently lowered to LLVM `atomicrmw` instructions.
…11230)

Correct Propery->Property and sprinkle a couple of extra comments.
@pull pull Bot locked and limited conversation to collaborators Jul 22, 2026
@pull pull Bot added the ⤵️ pull label Jul 22, 2026
@pull
pull Bot merged commit 05daf2a into MPACT-ORG:main Jul 22, 2026
15 of 17 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.