Skip to content

LLVM and SPIRV-LLVM-Translator pulldown (WW48 2026) - #23932

Draft
iclsrc wants to merge 5282 commits into
syclfrom
llvmspirv_pulldown
Draft

iclsrc wants to merge 5282 commits into
syclfrom
llvmspirv_pulldown

Conversation

@iclsrc

@iclsrc iclsrc commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

arsenm and others added 30 commits November 7, 2026 11:21
Kill flags are no longer permitted on virtual registers, but these
contexts may also see physical registers. Those physical register
kills are either never set by the time this code runs or are on
reserved or constant registers where they carry no information.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Fixes a regression introduced in #238070, which changed `return
insertOp.getResult()` to `return insertOp.getDest()` in
`foldInsertUseChain`. `dest` is `InsertOp`'s destination vector rather
than its result.

Because of this change, folding `vector.insert` ops at the same position
replaced `insertOp` with its destination operand instead of signaling an
in-place fold, dropping the final insertion.

We also add a test to prevent this regression from happening again. 

cc @banach-space
fma(V, 1.0, -0.0) and fma(0.0, -0.0, V) equal V exactly, so fma
bundles model non-fma lanes as copyables, like fmuladd. fma lanes
never absorb fmul/fadd, so fma loses ties with fmul/fadd.

Assisted-by: Cursor

Reviewers: 

Pull Request: llvm/llvm-project#240039
The wide load reads the memory of the copyable loads from the
predecessor block too. Intersect their flags and metadata with the
other lanes instead of skipping them, which kept metadata the
predecessor load does not have.

Reported in llvm/llvm-project#233297 (comment)

Assisted-by: Cursor

Reviewers: 

Pull Request: llvm/llvm-project#240050
…eded (#239772)

A common block that is used in a compute region only as the `storage`
operand of the fir.declare of its members must not be implicitly mapped
as a
whole as it would clash with explicit mappings of the individual
members. When the common block is accessed directly, the mapping can be
done like before.
…nding mode assumption made by fadd/fsub (#240054)

I have plans to improve deductions made by `fadd`/`fsub` and `fma`.
However, some of these deductions are only valid for `fadd`/`fsub`, so I
have moved the `fma` logic outside of `fadd_impl` and into its own
`fma_impl` function. This allows us to make improvements to `fadd/fsub`
independently of `fma`, and it also makes it easier to audit
improvements to `fma`.

I also have plans to support the rounding mode for primitive arithmetic
functions llvm/llvm-project#228974, so I have
documented the `NearestTiesToEven` assumption that `fadd_impl` makes
when ruling out `-0.0`, allowing `fadd_impl` to be valid for all
rounding modes.
All that is left of InnerLoopVectorizer is a bundle of state passed to
executePlan, of which only the assumption cache, a fresh IRBuilder and
whether runtime checks were generated are used, plus fixVectorizedLoop,
which runs legacyCSE on the vector loop header.

Create the IRBuilder in executePlan, take the assumption cache from
Legal, pass whether there are runtime checks as a bool and run legacyCSE
directly. Also drop executePlan's DominatorTree argument, which is the
same as the planner's DT member, and update comments that still refer to
InnerLoopVectorizer.

PR: llvm/llvm-project#240055
Split off the check for expressions that are expanded in IR and hoisted
out of HoistOutOf, to reuse it in follow-ups.
…(#240067)

Add tests for nested loops whose runtime check bounds combine operands
invariant in the outer loop with variant ones.
…9953)

Update setBlockFreqAndScale to use native 128 bit integers instead of
APInt if available, as this improves compile-time:

stage1-O3: -0.7%
stage1-ReleaseThinLTO: -0.08%
stage1-ReleaseLTO-g: -0.06%
stage1-aarch64-O3: -0.07%
stage2-O3: -0.07%
stage2-clang: -0.14%


https://llvm-compile-time-tracker.com/compare.php?from=f82380b4c3ff92a6293f03f7c02e40249ba10e13&to=b885f69205b43f51764127d753eaed4fd91a12e8&stat=instructions:u

Assisted-by: Opus 5.5

PR: llvm/llvm-project#239953
  CONFLICT (content): Merge conflict in clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
Fixes #235368.

DAG combining can create a v2bf16 SCALAR_TO_VECTOR for byte-vector
concatenations, including copies of unaligned bfloat values through
local arrays. NVPTX treats the node as legal but lacks a selection
pattern.

Pack the bf16 value into the low half of a 32-bit register and zero the
unspecified high half, as already done for v2f16. Add regression
coverage for direct packing, unaligned loads, and the original
local-array copy.
…0077)

parseCondBranch() rebuilt the register operand of a branch-on-register
(BPR) instruction from just its register number, and insertBranch()
re-added it with addReg(), so any operand flags were lost when a branch
was analyzed and reinserted.

When the register is undef (ProcessImplicitDefs marks the use undef
after removing its IMPLICIT_DEF), PHI elimination splitting a critical
edge rewrites the terminator via updateTerminator() and the BPR ends up
reading a virtual register with no def. The machine verifier rejects
this, and without the verifier the greedy register allocator segfaults
in VirtRegAuxInfo::weightCalcHelper.

Copy the whole MachineOperand into Cond and add it back with add(), as
other targets do.

Fixes #233111

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
It is not possible to directly transfer values from integer registers to
floating point registers, so it needs to be done via the stack.

Fixes the following error:

  LLVM ERROR: Cannot select: t10: f64 = bitcast t16
    t16: v2i32 = BUILD_VECTOR t2, t4
      t2: i32,ch = CopyFromReg t0, Register:i32 %0
      t4: i32,ch = CopyFromReg t0, Register:i32 %1
  In function: v2i32_build_vector

Assisted-by: Claude
A leaf procedure stays in its caller's register window, so
remapRegsForLeafProc rewrites %i0-%i7 to %o0-%o7. PEI calls it from
determineCalleeSaves, while the parameter DBG_VALUEs at the start of the
entry block are stashed outside the function (stashEntryDbgValues), so
they keep naming %i registers and gdb reads the arguments of leaf
functions from the wrong register.

This renames the debug operands that are left once PEI has put the
stashed values back, in processFunctionBeforeFrameIndicesReplaced. Other
DBG_VALUEs on the same value were already renamed, it's only the stashed
parameter ones that were missed.

Fixes #235238.

`leaf.c` from the issue, `break get` in gdb, before:

```
Breakpoint 1, get (p=0x1) at leaf.c:5
```

after:

```
Breakpoint 1, get (p=0x7fefffff448) at leaf.c:5
o0             0x7fefffff448       8791798051912
```

The new test checks that a leaf function's parameter is described as %o0
and that a function with a register window still uses %i0.

Assisted-by: Claude Code (Claude Opus 5.5)
…899)

BPF borrowed the DWARF EH pipeline in an unsound way. DwarfEHPrepare
turned resume into a call of _Unwind_Resume, which will never be
linked in. BPFUnwindLower later replaced it, and calls of
_Unwind_RaiseException, by matching callee names after register
allocation. This fixes the pass pipeline relying on these transient
calls to phantom functions.

Instead add an invokable llvm.bpf.unwind.exit intrinsic, similar to
wasm's throw intrinsics. BPFUnwindPrepare replaces resume with it so
no impossible call to _Unwind_Resume reaches selection.

The intrinsic selects to a pseudo which BPFUnwindLower turns into
either unwind_exit or a branch to the landing pad when invoked. The
pseudo clobbers nothing, so register allocation can be more aggressive
than when the function looked like an ordinary call.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Use `RedeclarableTemplateDecl` to consolidate the identical
`isInstantiationOf` implementations for class and function templates,
leaving the other overloads unchanged.

I initially considered turning these helpers into a function template,
but the declaration types use different accessors, such as
`getInstantiatedFromMemberTemplate()` and `getInstantiatedFromMember()`.

I'd also like to discuss whether a function template would be preferable
here, although that would likely require a broader change.
The original patch added LLVM_ATTRIBUTE_WARN_UNUSED to some ADT classes,
which caused some more -Wunused-variable warnings under release builds
(that optimize out asserts).

https://lab.llvm.org/buildbot/#/builders/228/builds/17397
Replace the repeated restoration assignments with `llvm::scope_exit`.
This patch adds LLVM_ATTRIBUTE_WARN_UNUSED to SmallPtrSet so that
compilers can diagnose unused SmallPtrSet variables even though
SmallPtrSet has a non-trivial constructor and destructor.

This patch also addresses the existing warnings uncovered by the
attribute:

- ScheduleDAGSDNodes::BuildSchedUnits had an unused local variable
  Visited, which this patch removes.
- SmallPtrSetTest.cpp intentionally leaves Other unused in two move
  tests, so this patch marks Other with [[maybe_unused]].

Assisted-by: Antigravity
…on Android AArch64 (#240097)

Temporarily mark `TestCases/Linux/stack-overflow-recovery-mode.cpp`
unsupported on Android AArch64 while waiting for #236879, matching
#236884 (https://lab.llvm.org/buildbot/#/builders/186/builds/4079).

Assisted-by: Gemini
… (NFC) (#237180)

Extract checks on a memref's type out of
`optimizeSharedMemoryReadsAndWrites` into a new public function,
`canSwizzleSharedMemoryType`. The function would be helpful for prior
passes to reason about optimization decisions based on whether it is a
valid swizzling candidate.

Assisted-by: Claude
The enumerators of an unscoped enumeration are in the lookup table of
the enclosing context. Undoing the input that declared the enumeration
removed the enumeration, but its enumerators stayed visible:

```
clang-repl> enum E { Red };
clang-repl> %undo
clang-repl> int Red = 5;
error: redefinition of 'Red' as different kind of symbol
```

`ASTDeclUnmerger` now also visits the declarations of an undone
enumeration definition.

**Test:** new lit test `code-undo-enumerators.cpp` with three cases: an
enumerator reused as a variable, an enumeration redefined, and an
enumeration in a namespace. It checks printed values only, not
`printf()` output, whose order isn't reliable when stdout is a pipe
(#228358).

Context: these patches come from moving [ROOT](https://root.cern) from
Cling to clang-repl. ROOT builds a Cling-compatible layer on
`clang::Interpreter`, and its test suite found the issues below.

Assisted-by: Claude Opus 5.5
FTMs were updated in llvm/llvm-project#233352
but some copy & paste errors were made. This PR fixes them.
aobolensk and others added 27 commits November 25, 2026 23:39
Emit the operand as an id of an integer constant instead of a literal

Inspired by llvm/llvm-project#229056

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@a327dbb228b1e58
`llvm.vector.reduce.{add,mul,and,or,xor}` on `<N x i1>` built 1-bit int
type and emitted integer opcodes on it, which is incorrect

Also fix plain add i1 emission (replace it with not equal boolean op)

Inspired by llvm/llvm-project#207388

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@3bf94d039421e62
Always emit `CodeSectionINTEL` storage class for typed function
pointers, according to the `SPV_INTEL_function_pointers` spec,
regardless of the function's addrspace in LLVM module. Not doing so for
untyped function pointer yet until some ambiguity is resolved in the
spec.

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@3bb60b6dfc4ccf5
Update for llvm-project commit llvm/llvm-project@294d3132d468
("[IRBuilder] Deprecate ctors taking LLVMContext instead of Module
(#234212)", 2026-10-21).

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@e05c9023a3b033b
Since llvm/llvm-project@6519eee75a87 the SPIR-V backend types the
get_fence pointer argument as i8, so reverse translation of its output
yields the same get_fence (const void *) call as the translator's own
round-trip.
Check both paths with CHECK-LLVM instead of a separate CHECK-LLC block.

Fixes the in-tree build failure in
`transcoding/OpGenericPtrMemSemantics.ll`.

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@39ab20b8bc2c8f3
llvm.memcpy.inline was rejected as an unexpected intrinsic. LangRef
defines it as llvm.memcpy plus a guarantee that no external function is
called, which OpCopyMemorySized already meets, so it is now translated
exactly like llvm.memcpy.

Split out of #3990.

This PR was generated using AI

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@3093b18468e2842
This is debatably NFC, since adding a name map entry twice simply
overwrites the previous entry.

I accidentally added the SubgroupBitcastShuffleINTEL capability to the
name map twice in #4022, probably while switching from internal enums to
upstream enums, and didn't notice until now.

Even though this shouldn't cause any problems, I'd like to get this
fixed before creating backports.

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@abfe1e4d453d0d1
Since dd1ae8e9 ("[NFC] Show the latest SPIRV-Tools commit in
prebuild-spirv-tools workflow (#4080)", 2026-10-13) the job was failing
with `fatal: not a git repository` because `git log -1` was run in the
wrong directory.

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@5b2e576bc163334
Factor out various libSPIRV-Tools helper functions into their own
module, to prepare for future reuse by the SPIR-V writer.

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@4a19bdafebf0898
OpenCL.std `printf` requires the Format operand to be a pointer to 8-bit
integer.
For calls to the unmangled `printf` emitted by clang for OpenCL C, the
format string global was passed through with its array type, producing a
pointer to an array of i8.

After KhronosGroup/SPIRV-Tools@c7686c53f, `spirv-val` rejects such
modules with `"expected Format data type to be 8-bit int"`.
Apply the same `i8` pointer typing to plain `printf` calls as to
`__spirv_ocl_printf`, so the format operand is bitcast to a pointer to
i8.

Fixes the following test failures:
```
  LLVM_SPIRV :: extensions/EXT/SPV_EXT_relaxed_printf_string_address_space/builtin_printf.ll
  LLVM_SPIRV :: transcoding/BuiltinPrintf.cl
  LLVM_SPIRV :: transcoding/Printf.cl
```

AI-assisted: Claude Code

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@aaac696a9c87766
In SPIR-V friendly IR the reader records SaturatedConversion both as the
builtin name postfix and in !spirv.Decorations, so translating the
result back applied the decoration twice and produced invalid SPIR-V.
transMetadataDecorations now skips SaturatedConversion when the postfix
already set it.

Fixes #4085

This PR was generated using AI

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@72928853701eceb
`OpClampConvertFToSINTEL` rounds to nearest even and the
`StochasticRound*` opcodes round stochastically, so no explicit
`FPRoundingMode` is valid on them.
Plain conversions to a mini-float encoding stay unrestricted here,
leaving it to the client API's environment spec.

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@06db465fc87a0d9
Fixes #3179.

This change was worked out with LLM assistance and then reviewed, built and
tested by me before posting.

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@360124683906453
llvm.llround, llvm.lrint and llvm.llrint were rejected as unknown
intrinsics. They now reuse the llvm.lround lowering: OpenCL.std round,
or rint for lrint/llrint, followed by OpConvertFToS. The shared case
also diagnoses argument types SPIR-V has no float type for, and i1
results, instead of asserting or emitting invalid SPIR-V, and all four
are registered in isKnownIntrinsic.

Out-of-range results keep the existing lround behaviour (a plain
OpConvertFToS, undefined in SPIR-V, where LangRef specifies freeze
poison). SaturatedConversion would fix that, but an SPV-IR round trip
currently duplicates that decoration, as it already does for
llvm.fptosi.sat, so that is left for a separate change.

This PR was generated using AI

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@5704788d47b1e8d
transType handled only fixed vectors, so any LLVM scalable vector type
(for example an alloca of <vscale x 4 x i32>) fell through to
llvm_unreachable. SPIR-V has no runtime-sized vector type, so report
InvalidModule the same way the token type check right above does, and
add a negative test.

Fixes #4095

This PR was generated using AI

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@7e95795b6010821
Addresses the `getIds()` hit of #3180.

`getIds()` takes the operand vector by value, but every caller keeps ownership of what it passes, so the whole vector is copied on each call. Taking it by `const &` removes that copy and leaves all four call sites untouched.

CID 489584 points at `Elements = getIds(TheElements)`, which is already a move-assignment; the copy is this parameter.

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@3dee43cb3a56336
The `DIExpression` in DebugDeclareUnused.cl (generated by clang) is
invalid. A clang fix may be landed in the future, but it will break this
test, thus update the test now in advance to avoid failure when the
clang fix is merged later.

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@716614e94af9e75
The
[NonSemantic.Shader.DebugInfo](https://github.khronos.org/SPIRV-Registry/nonsemantic/NonSemantic.Shader.DebugInfo.html#DebugLocalVariable)
spec requires that the (optional) ArgNumber operand for a
DebugLocalVariable operation is the id of a 32-bit OpConstant.

This patch ensures that both the LLVM to SPIR-V and SPIR-V to LLVM paths
through the translator respect this requirement.

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@273df79c51d67c7
Use the extended multiply to avoid double width integers, so i64 needs
no i128

The .sat variants are not handled, matching the SPIR-V backend

Part of the patch is inspired by
llvm/llvm-project#206507

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@3845c56f2de28a9
Fix the merge conflict resolution: x86-fence-nontemporal-stores runs
before the downstream fpbuiltin-fn-selection pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Upstream 0b4ac27 added a NestedDefaultArg/Wrapper section to
SemaCUDA/device-rtti.cu whose expectations rely on the deferred
diagnostic deduplication of upstream #185926. That change is reverted
downstream (febb2b8), and the earlier adaptation in 93424d3
only covered the LambdaBody section.

Without the deduplication, the typeid error at #default_arg and the
"default member initializer used here" note are emitted once for
nested_default_arg and once for wrapper, and the wrapper note reads
"called by" instead of "which is called by". Update the expectations
and add a FIXME to restore them when #185926 is relanded.

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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 1702bb273559d1e03362f6f47b93f722c5e62a05)
The test added by 11836e7 (KhronosGroup/SPIRV-LLVM-Translator#3769)
runs spirv-as but does not require it, so it fails in builds without
SPIRV-Tools. All other spirv-as based tests have this requirement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Upstream e422530 brought back sycl-offload-jit-xarch.cpp, which
checks that -Xarch_spirv64 options are forwarded to clang-linker-wrapper
via --device-compiler=/--device-linker=. That forwarding was reverted in
intel/llvm (9bec7a5), so keep only the device compilation check,
as done in xmain (df0da2e06a29).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Upstream 12e5222 added a SPIR-V classifier to the LLVM ABI library
and the CodeGenSPIRV/abi-lowering.cpp test. The classifier puts the sret
pointer of a record that cannot be copied in the default address space,
matching upstream Clang. Downstream, -foffload-use-alloca-addrspace-for-srets
is on by default and Clang puts sret pointers in the alloca address space
instead, so with -fexperimental-abi-lowering the assertions-enabled
consistency check aborted with:

  For return value of type struct NoCopy: IndirectAddrSpace mismatch
  (expected: 0, given: 4)

Apply the same override to the ABI library return info, and update the
test to expect the downstream private sret pointer for the GEN runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@iclsrc iclsrc added the disable-lint Skip linter check step and proceed with build jobs label Nov 25, 2026
jsji and others added 2 commits November 26, 2026 01:55
…after 5148cbe

Upstream 5148cbe ("[CMake] Enable -Werror=global-constructors for
llvm/lib") enables -Werror=global-constructors for llvm/lib and exempts
libraries that still have static initializers via an allowlist. The
downstream SYCL libraries are not on that list, but still define global
cl::opt objects (and, for SYCLPostLink, the static map generated in
DeviceConfigFile.inc), so clang builds fail with "declaration requires a
global destructor".

Add a separate downstream allowlist for LLVMNativeCPUPipeline,
LLVMNativeCPUVecz, LLVMSYCLLowerIR, LLVMSYCLNativeCPUUtils and
LLVMSYCLPostLink.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fter 5148cbe

Upstream 5148cbe ("[CMake] Enable -Werror=global-constructors for
llvm/lib") appends -Werror=global-constructors to CMAKE_CXX_FLAGS in
llvm/lib. vc-intrinsics is fetched via FetchContent from
llvm/lib/SYCLLowerIR, so LLVMGenXIntrinsics inherits the flag and clang
builds fail on its global cl::opt EnableGenXIntrinsicsCache with
"declaration requires a global destructor".

Add LLVMGenXIntrinsics to the downstream allowlist, and skip IMPORTED
targets (vc-intrinsics found via find_package), since PRIVATE compile
options cannot be set on them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disable-lint Skip linter check step and proceed with build jobs

Projects

None yet

Development

Successfully merging this pull request may close these issues.