Skip to content

Update 2026-07-09 - #30

Merged
SupernaviX merged 5178 commits into
mainfrom
update-2026-07-09
Jul 10, 2026
Merged

Update 2026-07-09#30
SupernaviX merged 5178 commits into
mainfrom
update-2026-07-09

Conversation

@SupernaviX

Copy link
Copy Markdown
Owner

it's time

Vladimir Suvorov and others added 30 commits July 8, 2026 13:03
…3583 (llvm#207995)

StableHLO tests have regression due to use of additional op parameter in
verifyBlockScaledTensorType

This adjusts llvm#203583 and fixes
many of stablehlo/tests

Signed-off-by: Vladimir Suvorov <suvorovv@google.com>
…m#206242)

Fixes llvm#206153

`smax(X, -1) = or(X,  ashr(X, BW-1))`
`smin(X,  0) = and(X, ashr(X, BW-1))`

`ashr(X, BW-1)` sign-extends the sign bit to all bits 0 for X≥0, -1 for
X<0. OR-ing with X yields X or -1 = smax(X,-1), AND-ing yields 0 or X =
smin(X,0). Both replace a `compare+cmov` with two cheap bitwise
instructions.

The fold is unconditional (not gated on code size), firing whenever the
target has no native `SMAX/SMIN` instruction for the type
(`isOperationExpand`), the type is legal (`isTypeLegal`), and the input
is not a min/max chain (preserving RISCV-P `sati` saturation patterns).
…vm#207935)

This PR provide a manior fix to issue llvm#207858 when the `ucobound` array
is passed to mif.alloc_coarray. This array was built from the values in
`lcobound`.
…8214)

Adds ORC_RT_LOG(Level, Category, Fmt, ...), a compile-time-configurable
logging facility for the ORC runtime, along with the default "none"
backend.

The backend is chosen at build time via the ORC_RT_LOG_BACKEND CMake
option (none, printf, os_log), and the lowest level to be compiled in
via ORC_RT_LOG_LEVEL.

The "none" backend implemented here compiles every log site out to
nothing (but still type-checks the format string and arguments in an
unevaluated context so disabled sites cannot bit-rot). Levels are Error,
Warning, Info, and Debug; categories are a typo-safe enum.

The printf and os_log backends are stubbed with #error and will follow.
…cro in debug builds (llvm#208106)

This partially reverts commit 8b50847.

The LLVM_ATTRIBUTE_ALWAYS_INLINE on STMT macro fallback methods caused
stack overflow in debug builds when processing deeply nested
expressions.
The test many-logical-ops.c with 2000+ logical AND operators would crash
in SequenceChecker due to excessive stack consumption.

Introduce LLVM_ATTRIBUTE_ALWAYS_INLINE_UNLESS_DEBUG which expands to
LLVM_ATTRIBUTE_ALWAYS_INLINE in release builds (preserving the binary
size optimization) but to plain `inline` in debug builds (avoiding stack
overflow).

Apply this to the STMT macro while keeping LLVM_ATTRIBUTE_ALWAYS_INLINE
on BINOP_FALLBACK, CAO_FALLBACK, and UNARYOP_FALLBACK.

Fixes regressions in debug builds only:
   Clang :: C/C99/n590.c
   Clang :: Index/index-many-logical-ops.c
   Clang :: Sema/deep_recursion.c
   Clang :: Sema/many-logical-ops.c

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Summary:
Since llvm#201457 these targets
defaulted to LTO. However, this caused the default for
`--offload-device-only` to now be LLVM-IR. This is a regression from
prior behavior, so we special case it out. Honestly this would probably
be correct if the behavior started like this, but we shouldn't break
existing code.
The PPA1 contains fields recording the length of the prolog and the
offset to the instruction updating the stack pointer register. The
implementation consists of the following parts:
- the end of the prolog is marked with a FENCE instruction which
prevents scheduling from moving instructions across the barrier.
- when emitting the PPA1, the FENCE instruction along with other stack
update instructions are used to calculate the length and the offset.

Co-authored-by: Tony Tao <tonytao@ca.ibm.com>
llvm#208068)

…loads

AMDGPULowerKernelAttributes upgrades the pre-COV5 pattern
  udiv(grid_size_x, group_size_x)
to a direct load of hidden_block_count_x from the implicit args. The
m_Load() pattern matcher does not check whether the matched load is
volatile or atomic, so a volatile or atomic grid_size load would have
been silently deleted and replaced -- dropping its observable side
effects in violation of the LangRef.

Fix: after the pattern match succeeds, cast the matched value to
LoadInst and bail out if !isSimple() (i.e., volatile or atomic).

Add a test case num_blocks_x_volatile_grid_size in
implicit-arg-block-count.ll to verify the volatile load and udiv are
preserved unchanged.
…gs (llvm#205592)

AMDGPULibCalls::fold_pow rewrote pow(x, 0.5)->sqrt(x) and pow(x,
-0.5)->rsqrt(x) unconditionally, firing before the
isUnsafeFiniteOnlyMath guard. This is incorrect for two IEEE corner
cases:

  pow(-Inf, 0.5) == +Inf  but  sqrt(-Inf) == NaN
  pow(-0.0, 0.5) == +0.0  but  sqrt(-0.0) == -0.0

Guard the fold on hasNoSignedZeros() && (IsPowr || hasNoInfs()), where
IsPowr is true for powr/powr_fast. The OpenCL spec requires x >= 0 for
powr, so -Inf is undefined behaviour and the ninf check can be skipped;
-0.0 is a valid input for powr since -0.0 >= 0 by IEEE comparison, so
nsz is still required for all variants. afn alone is not sufficient
since it only permits approximate results and says nothing about the
treatment of infinities or signed zeros.

Update the four autogenerated test files to reflect the new semantics:
- Add nsz (and ninf for pow) to existing afn-only ±0.5 call sites so
those tests continue to exercise the fold as intended. powr tests use
nsz only, documenting that ninf is not required.
- Add afn-only (no nsz/ninf) ±0.5 tests in pow-fast.ll and powr-fast.ll
to document that afn alone does not trigger the fold.
…Parser (llvm#207142)

This improves upon the shared near-miss reporting infrastructure added
in llvm#205721 by handling a case that was deferred during that PR's review.

Assisted-by: claude-opus
…(NFC) (llvm#207979)

`time-intrinsic.cpp` implements the timing intrinsics as SFINAE overload
sets (preferred/fallback per platform), so on any given platform some
overloads are intentionally never instantiated and trip
-Wunused-template. Mark all variants [[maybe_unused]].

`StoreElement` and `MakeArray` in `unittests/Runtime/tools.h` are static
function templates in a header, so any test TU that includes it without
using all of them trips the warning.

Part of llvm#202945
Libc++ has a warning that triggers on empty namespaces. When
_LIBCPP_BUILDING_LIBRARY is not defined, the __locale namespace was
empty. This PR moves the #ifdef to surround the namespace and fix the
warning.
…lvm#202843)

Outline language-option mismatch diagnostic construction into two
`noinline` helpers. Generated comparisons remain direct and ordered as
before, so successful imports add no indirect calls and the serialized
format is unchanged.

Linked `clang` and `clangd` shrink by 35,264 and 29,216 bytes
respectively; `ASTReader.cpp.o` shrinks by 62,712 bytes with 1,347 fewer
relocations, while linked fixups are unchanged.

PCH, PCM, and BMI outputs and mismatch diagnostics are byte-identical,
focused module/PCH tests pass, and batched PCH and module imports show
no significant performance change.

Work towards llvm#202616

AI tool disclosure: Co-authored with OpenAI Codex.
…lvm#207784)

Add requiresScalarEpilogue(Plan, VF) that directly checks if a scalar
epilogue is required for a VPlan. In that case, the middle block (i.e.
first predecessor of the scalar ph) unconditionally branches to the
scalar preheader.

For now added to LoopVectorizationPlanner, so we can assert that the
result of the VPlan check matches the legacy result, to catch any
potential divergences.

The helper should be moved to VPlan directly and the assertion dropped
when no divergences have been found for a while, to make it independent
of the cost mode.

PR: llvm#207784
…#208222)

The function is already a shadowed member of the class.
Clang lit test `Sema/warn-lifetime-safety-suggestions.cpp` is failing
because the encoding for the new contents of the source file don't match
the file tag on the file.

This change ensures the contents of a file are written in the same code
page as the existing file.

- The copyFileTagAttributes() function will change the auto conversion
to the code page of the file tag when writing a new version of a file.
- When writing to an existing file (eg. appending), use the file tag as
the code page for auto conversion. Don't assume 1047.
The libsycl runtime depends on multiple clang tools.
We should ensure that these tools are built.

---------

Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
`Features.def` currently expands 228 feature formatting expressions and
49 extension formatting expressions in
`DumpCompilerOptionsAction::ExecuteAction`. This stores the names in
NUL-separated character blobs, evaluates the predicates into local
`bool` arrays, and formats both arrays with `writeCompilerOptionValues`.

In a Release arm64 build, standalone clang decreases by 49,256 bytes
unstripped and 49,520 bytes stripped, while the LLVM multicall binary
decreases by 49,264 bytes unstripped and 49,528 bytes stripped; linked
`__text` decreases by 52,696 bytes and linked fixups decrease by 7.

Work towards llvm#202616

AI tool disclosure: Co-authored with OpenAI Codex.
Introduce VectorConvertRemove to remove extraneous qf->sf/hf conversions
after XQFloat code generation. Off by default, enabled with
-enable-rem-conv.

Co-authored-by: Santanu Das <quic_santdas@qti.qualcomm.com>
…s with bfloat16 type (llvm#205128)

For `OpExtInst`, add check for bfloat16 type when it's an OpenCL.std
extended instruction, and add requirements for
SPV_INTEL_bfloat16_arithmetic if so.

Add such check and extension requirement since OpenCL.std extended
instruction set can operate on IEEE-754 FP types only, as per the
revision from [OpenCL.std
spec](https://registry.khronos.org/SPIR-V/specs/unified1/OpenCL.ExtendedInstructionSet.100.html#_changes_from_version_1_0_revision_8)

---------

Co-authored-by: Viktoria Maximova <viktoria.maksimova@intel.com>
…ults and operands (llvm#203237)

This commit enables custom legalization for v1 types for intrinsic results and operand by calling CustomLowerNode which gives the target a chance to custom handle the node before scalarizing

To demonstrate, I have used tcgen05.ld/st intrinsics which previously used a scalar i32 type while all wider variants used vector types

Assisted by: Claude Code
…lvm#207918)

This PR matches the libc++ update from
llvm#198595 and applies similar
changes to `llvm::thread` class. Please see the discussion in that PR
(and linked references to other PRs) for more background / discussions.

`llvm::thread` has methods for extracting integer IDs from running
threads, and as such it needs to know what types are used to represent
those integer IDs - something that e.g. pthreads or C11 threads don't
specify. It assumes that `pthread_t` can be used both as a handle and as
a thread-id on most platforms, with the exception of zOS, where the
custom code is written. In LLVM-libc `pthread_t` is not an integral
type, but today it provides `pthread_id_np_t` type and
`pthread_getunique_np` / `pthread_getthreadid_np` methods as extensions
to extract the integer IDs. Use these methods when building against
LLVM-libc.

This is one of few remaining blockers for building LLVM+Clang on top of
LLVM-libc (llvm#97191).
…vm#205133) (llvm#205522)

This reverts commit 08c728e.

Reapply after runtimes build fixes on platforms without shared
libraries.
…07729)

Teach IsKnownPredicateViaMinOrMax to handle ICMP_ULT/UGT for
SCEVUMinExpr. Since umin(Ops) u<= each Op by definition, proving Op u<
RHS for any single operand is sufficient to establish umin(Ops) u< RHS
by transitivity.

This unblocks loop vectorization for early-exit loops whose trip count
is a umin of a buffer length and an iteration bound.

Fixes llvm#196935

Alive2 proof: https://alive2.llvm.org/ce/z/9DjA2f
…amounts (llvm#205489)

The register-variable 32-bit funnel shifts and the i32 rotates that
lower through them, realize the shift as a 64-bit asl/lsr of the {hi,lo}
combine and take one word of the result. That identity only holds for a
shift amount in [0, 31], and llvm.fshl/fshr define the amount to be
taken modulo 32. The register-form variable shift does not reduce the
amount modulo the operand width, it treats the low 7 bits as a signed
amount in [-64, 63]. So the raw, unreduced amount must be masked with
#31 before the 64-bit shift.

Without the mask, counts >= 32 or "negative" counts are miscompiled: a
count of 63 shifts left by 63, 64 becomes -64 and shifts the value out
entirely, and -1 becomes an arithmetic right shift by 1. In-range counts
0..31 come out correct, which is why a test that only sweeps 0..31 does
not catch it. This is exactly the i32.rotl/i32.rotr miscompile that
caused the WAMR Wasm spec-test suites (which invoke rotates with counts
of 32, 33, and -1) to be skipped on Hexagon.

Fix by masking the amount with (A2_andir $Ru, 31), mirroring the masking
the 64-bit patterns already use. This completes the 32-bit case left
unaddressed by 4fffee0 ("[Hexagon] Fix 64-bit funnel shift
miscompilation with register shift amounts", llvm#183669), which fixed only
the FShl64r/FShr64r width.
)

By default, we shouldn't add expensive verifier passes to the pipeline.
This causes a substantial perf regression compared to the legacy PM.
Add shared helpers for reading, setting, and manipulating parallel
dimensions on operations, covering both discardable and inherent
attributes.
AbdallahRashed and others added 28 commits July 9, 2026 17:31
…entity (llvm#187870)

Track lane indices through vector bitcasts that change element count in
foldShuffleToIdentity. Widening bitcasts (e.g. <2 x i32> -> <4 x i16>)
compress R consecutive destination lanes into one source lane, while
narrowing bitcasts (e.g. <4 x i16> -> <2 x i32>) expand each destination
lane into R source lanes.

Also fix identity check, splat mask, and destination type construction
to use Item.size() instead of Ty->getNumElements(), since the Item
vector changes size when passing through element-count-changing
bitcasts.

Fixes llvm#96884
The forward_list tests historically used "range" to mean an iterator
pair, but we use `iter_iter` pretty consistently elsewhere in the test
suite. Using `range` also makes it confusing with the actual tests for
`_range` operations, like `append_range` or `assign_range`.
That test was checking prepend_range instead of assign_range due to a
copy-paste error.

Fixes llvm#74536
…m#208284)

This commit is an update to `wasm-ld`'s behavior with bss data segments
with `--cooperative-threading`. Previously bss segments were forced to
become passive data segments meaning that a `start` function was emitted
with a `memory.fill` that set the required region of memory to 0. This
isn't required for coop threads though because the module is only
instantiated once and the default pattern for memory is 0, so only
special treatment of TLS segments are required.
Breaks some buildbots with gcc. Looks like constexpr member definitions
need an extern for old gcc otherwise they get local linkage...

Reverts llvm#208407
We already harden std::array<T, 0>::front() and back(), and we have
tests for it.

Closes llvm#171330
…n-i64 kinds (llvm#208429)

Both COSHAPE and THIS_IMAGE(coarray [,team]) return integer arrays whose
element type is determined by the Fortran KIND argument (default: i32).
The lowering code was ignoring resultType in both cases and hardcoding
i64, which caused downstream type mismatches:

- COSHAPE: SimplifyHLFIRIntrinsics assertion in PRODUCT(COSHAPE(y)) when
the product input type (i64) did not match the declared result type
(i32).
- THIS_IMAGE(coarray): MLIR verifier error on arith.cmpi with mismatched
operand types (i64 vs i32) in comparisons like THIS_IMAGE(a) /=
[5,0,-7].

Fix: derive eleTy from resultType in both genCoshape and genThisImage
and propagate it into the mif.* op's result type. In MIFOpConversion,
extract a shared convertI64SeqToEleTy helper that post-converts the i64
scratch buffer written by the PRIF runtime into the
declared-element-type buffer when the two types differ. Both
MIFCoshapeOpConversion and MIFThisImageOpConversion call this helper.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
…nchmarks (llvm#208412)

The point of the custom predicates is to defeat any detection of special
predicates within the library. There isn't much point in adding
`benchmark::DoNotOptimize` on top of that. It can actually hurt, since
it may hide performance changes due to how much/which information we
provide to the compiler.
fadd(x, c) and fsub(x, c) are interchangeable via fadd(x, -c), so treat
them like the existing Add/Sub/Mul/Shl/AShr/And/Or/Xor interchange in
BinOpSameOpcodeHelper. This lets a mixed fadd/fsub bundle vectorize as
a single op instead of needing an alt-shuffle/split node.

Restrict the interchange to a constant RHS. A constant LHS (e.g.
"0.0 - x") cannot be moved to the other opcode without also swapping
the variable operand, which would misalign it against lanes that keep
their native opcode and produce a node too expensive to vectorize.

Reviewers: hiraditya, bababuck, RKSimon

Pull Request: llvm#208002
This was problematic because these CMake headers were never intended to
be used from a GPU target. We had to hack around this to suppress
threads, but all this is used for is getting the default CUDA path, so
just do this directly.
llvm#208505)

In release builds, the variable is now unused. Sink and inline into
single user to silence warning.
…)) over UNPCKL(SHUFFLE(X), SHUFFLE(Y)) (llvm#208503)

If blends are cheap and at least one input is a noop - perform a
permute+blend
The downstream swift CI is getting PermissionError instead of
FileNotFoundError for a [couple of
tests](https://ci.swift.org/job/pr-apple-llvm-project-llvm-linux/1819/consoleFull#-556494529d6fdb6cb-f376-4f2e-8bce-d31c7304698b).
I have no idea what is wrong with our CI, but we should be handling
those errors the same way anyway.

Also fix documentation typo.
…lvm#196635)

Earlier, special `lifetime_capture_by` spellings `global` and `unknown`
could conflict with actual parameter names, causing [some
code](https://godbolt.org/z/YWhW1dnoe) to fail to compile.

Because of that, we deprecate those parameters (they can probably be
removed in the near future)

llvm#192102

Assisted-by: GPT-5.4 for cleanup
In preparation of moving the implementation from `LegalizeDAG` into
`ExpandIRInsts`.
…llvm#208404)

The constraint system uses 64-bit coefficients and previously aborted
the entire elimination as soon as a single row combination overflowed.

This is unnecessary pessimistic and can lead to lost optimizations if
the system contains constraints with large coefficients which do not
contribute to a particular solution (e.g. signed wrap checks).

Instead, skip only the overflowing row combination and continue.

Compile-time impact is in the noise:

https://llvm-compile-time-tracker.com/compare.php?from=4f41b6be1a89796d6ce89188a4fd4e0cde9d06b7&to=1dedecc1cefea9c94631cdb272717d898ac6696b&stat=instructions:u

PR: llvm#208404
…llvm#205930)

When a target's `getVTableUniqueness()` is `UniqueIfStrongLinkage`, as
on Apple Mach-O, the platform may emit a class's weak vtable as a
separate copy in more than one linkage unit. A symbol that can
legitimately exist at several addresses has no meaningful address, so
such a vtable can be marked `unnamed_addr`.

On Mach-O, a weak vtable that is `unnamed_addr` lowers to a
`.weak_def_can_be_hidden` definition, which the static linker coalesces
and then drops from the dynamic export trie. Keeping these vtables out
of the exported symbol set cuts the work dyld has to do at load time.

llvm#200108 dropped `unnamed_addr` from vtables because the exact
`dynamic_cast` optimization compares an object's vtable pointer against
a known vtable address and depends on that address being unique. Adding
`unnamed_addr` is safe here because that optimization is never performed
for these weak vtables, so nothing relies on them having a unique
address.

rdar://179929460
On z/OS, the user has a choice between two different va_list formats.  
1. (default) uses the __builtin_zos_va_list typedef for va_list, being
added in this change
2. (-D_VARARG_EXT_) uses __builtin_va_list typedef for va_list.

The __builtin_zos_va_list type is `char * [2]`. 

This PR adds this type along with the __builtin_zos_va_start(),
__builtin_zos_va_end() & __builtin_zos_va_copy() functions to go with
it.
Fix the detected UB in the `stack_larger_than_signed_64bit_warning`
test-case. Now just checks that the warning is correctly not emitted.
This reverts commit b69ec10.

Recommit with small fix for potential nullptr dereference.

Original message:
Currently hasEarlyExit misses cases where we have things like dead exit
blocks or simplified the middle block.

Update to check by counting the predecessors.

This fixes a case where we missed properly updating LoopInfo due to
incorrect results.

Fixes llvm#206007.
@SupernaviX
SupernaviX merged commit 8001461 into main Jul 10, 2026
@SupernaviX
SupernaviX deleted the update-2026-07-09 branch July 10, 2026 01:39
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.