LLVM/project b9193b3 — clang/lib/CIR/CodeGen CIRGenOpenMPClause.h CIRGenOpenMPClause.cpp, clang/test/CIR/CodeGenOpenMP not-yet-implemented.c single.c

[CIR][OpenMP] Add support for omp single construct (#243797)

**Issue**: emitOMPSingleDirective was Not-Yet-Implemented, so #pragma
omp single hit error NYI in ClangIR codegen.

**Fix**: Lower OMPSingleDirective to omp.single, adding an emitNowait
clause emitter. allocate, copyprivate, firstprivate, and private clauses
remain NYI. Add CIR and LLVM lowering tests.

**Note**: In the LLVM IR tests, the outlined parallel function is
checked separately for ClangIR (LLVM-CIR) and classic codegen
(LLVM-OGCG). The control flow is the same in both, but the blocks are
named and ordered differently. See the test case comments for more
details.

Assisted by Claude.

Towards: #246586
DeltaFile
+282-0clang/test/CIR/CodeGenOpenMP/single.c
+41-2clang/lib/CIR/CodeGen/CIRGenStmtOpenMP.cpp
+4-4clang/test/CIR/CodeGenOpenMP/not-yet-implemented.c
+7-0clang/lib/CIR/CodeGen/CIRGenOpenMPClause.cpp
+2-0clang/lib/CIR/CodeGen/CIRGenOpenMPClause.h
+336-65 files

LLVM/project c145162 — llvm/test/MC/Sparc sparc-cas-instructions.s sparc-crypto.s

[Sparc][MC] Check line and column of errors in assembler tests (#247426)

Pin the line and column of the expected errors in the SPARC assembler
tests, instead of only checking the message (or, in sparc-asm-errors.s,
the line with any column).

Also add --implicit-check-not=error: where it was missing so unexpected
errors are caught, and fix the gaps this shows:

- sparcv9-synthetic-instructions.s did not check the V8 error for the
  second setuw.
- sparc-mem-asi-instructions.s did not check the V8 error for
  "lduba [%i0+%i1] %asi, %o2".
- sparc-directive-xword.s had the same .xword test twice and only
  checked the error for the first. Keep one, and use one check prefix
  for sparc64 and sparcv9.
- sparc-vis3.s had --implicit-check-not=error: on the run that has no
  errors instead of the one that does.

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+74-74llvm/test/MC/Sparc/sparc-vis.s
+60-60llvm/test/MC/Sparc/sparc-osa2011.s
+42-42llvm/test/MC/Sparc/sparc-vis3.s
+40-40llvm/test/MC/Sparc/sparc-asm-errors.s
+26-26llvm/test/MC/Sparc/sparc-crypto.s
+22-20llvm/test/MC/Sparc/sparc-cas-instructions.s
+264-2625 files not shown
+319-31511 files

LLVM/project cdd837b — llvm/lib/Target/LoongArch LoongArchISelDAGToDAG.h LoongArchLASXInstrInfo.td, llvm/test/CodeGen/LoongArch/lasx sat.ll

[LoongArch] Select [X]VSAT for vector clamps to narrower ranges

[x]vsat.{b/h/w/d} clamps each element to [-2^imm, 2^imm - 1], and
[x]vsat.{bu/hu/wu/du} to [0, 2^(imm + 1) - 1]. Select them for smin/smax
pairs and umin with such constant bounds, so that e.g.

```
  lu12i.w       $a0, -8
  vreplgr2vr.w  $vr1, $a0
  vmax.w        $vr0, $vr0, $vr1
  vldi          $vr1, -2433
  vmin.w        $vr0, $vr0, $vr1
```

becomes:

```
  vsat.w        $vr0, $vr0, 15
```

    [4 lines not shown]
DeltaFile
+31-108llvm/test/CodeGen/LoongArch/lsx/sat.ll
+31-108llvm/test/CodeGen/LoongArch/lasx/sat.ll
+60-0llvm/lib/Target/LoongArch/LoongArchISelDAGToDAG.cpp
+23-0llvm/lib/Target/LoongArch/LoongArchLSXInstrInfo.td
+18-0llvm/lib/Target/LoongArch/LoongArchLASXInstrInfo.td
+2-0llvm/lib/Target/LoongArch/LoongArchISelDAGToDAG.h
+165-2166 files

LLVM/project 9e0415b — llvm/test/CodeGen/LoongArch/lasx sat.ll, llvm/test/CodeGen/LoongArch/lsx sat.ll

[LoongArch][NFC] Add tests for vector saturation to narrower ranges

Add tests for clamping vector elements to the range of a narrower signed
or unsigned integer, as produced by portable implementations of the
[x]vsat intrinsics.

Assisted-By: LLM
DeltaFile
+637-0llvm/test/CodeGen/LoongArch/lsx/sat.ll
+637-0llvm/test/CodeGen/LoongArch/lasx/sat.ll
+1,274-02 files

LLVM/project 1f1ee66 — llvm/lib/Target/LoongArch LoongArchMergeBaseOffset.cpp, llvm/test/CodeGen/LoongArch merge-base-offset-fold-offset-debug.mir

[LoongArch] Fold offsets past debug uses in LoongArchMergeBaseOffset

With `-g`, a DBG_VALUE of the base address counts as a use, so the
`hasOneUse()` check in `detectAndFoldOffset` rejects folding a following
ADDI/ADD into the address materialization, and the generated code differs
from `-g0`:

  pcalau12i $a0, %pc_hi20(a)
  addi.d    $a0, $a0, %pc_lo12(a)
  addi.d    $a0, $a0, 5

Only count non-debug uses there and in the check for two ADDIs in a row.
After the fold the base register holds the address plus the offset, so
salvage its debug users by appending the negated offset to their
expressions, as RISCVMergeBaseOffset already does. In the two-ADDI case,
also redirect the debug users of the intermediate ADDI to the folded
register with the second immediate subtracted, instead of leaving them on
an erased definition.

Assisted-By: LLM
DeltaFile
+106-0llvm/test/CodeGen/LoongArch/merge-base-offset-fold-offset-debug.mir
+34-7llvm/lib/Target/LoongArch/LoongArchMergeBaseOffset.cpp
+140-72 files

LLVM/project 58d92bd — llvm/lib/Target/LoongArch LoongArchOptWInstrs.cpp, llvm/test/CodeGen/LoongArch sextw-removal.ll sextw-hoisting.ll

[LoongArch] OptWInstrs: Sign-extend outer PHI operands to remove sext.w in loops

A sext.w inside a loop often cannot be removed only because one of the
values reaching it comes in through a PHI from outside the loop and is not
known to be sign-extended, e.g. an i32 argument that is only any-extended:

  preheader:
    ...
  loop:
    %p = PHI %x, %preheader, %next, %loop
    %s = ADDI_W %p, 0
    %next = ADD_D %p, ...

If every other value reaching the sext.w is sign-extended, sign-extend
those PHI operands in their incoming blocks instead and remove the sext.w.
This trades a sext.w executed on every iteration for one executed once per
entry into the loop.

Only incoming blocks with a smaller loop depth than the sext.w are

    [8 lines not shown]
DeltaFile
+171-17llvm/test/CodeGen/LoongArch/sextw-hoisting.ll
+90-12llvm/lib/Target/LoongArch/LoongArchOptWInstrs.cpp
+6-6llvm/test/CodeGen/LoongArch/sextw-removal.ll
+267-353 files

LLVM/project e57b509 — llvm/lib/Target/RISCV RISCVISelLowering.cpp, llvm/test/CodeGen/RISCV and-mask-shrink-loop.ll

[RISCV] Preserve replicated masks in demanded bits simplification (#247452)

A replicated AND mask can be shrunk when the resulting constant has
an equal materialization cost. Queries at different recursion depths
can then shrink it further and restore the replicated mask, causing
DAG combining to loop indefinitely.

Keep the existing mask when it already matches the replicated
candidate. Add a regression covering both -O0 and -O2.

Fixes #247417.

Assisted-by: TRAE CLI (GPT-6)
DeltaFile
+170-0llvm/test/CodeGen/RISCV/and-mask-shrink-loop.ll
+5-0llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+175-02 files

LLVM/project cd41072 — llvm/test/CodeGen/LoongArch sextw-hoisting.ll

[LoongArch][NFC] Pre-commit tests for sext.w removal through outer PHI operands
DeltaFile
+266-0llvm/test/CodeGen/LoongArch/sextw-hoisting.ll
+266-01 files

LLVM/project c88baa1 — clang/test/OpenMP dims_modifier_ast_print.cpp

[Clang][OpenMP][NFC] Make dims AST print tests conforming
DeltaFile
+8-8clang/test/OpenMP/dims_modifier_ast_print.cpp
+8-81 files

LLVM/project 107ef7c — llvm/lib/Target/LoongArch LoongArchPassRegistry.def LoongArchCodeGenPassBuilder.cpp, llvm/test/CodeGen/LoongArch avoid-sfb.ll

Port AvoidStoreForwardingBlocks to NewPM
DeltaFile
+75-37llvm/lib/Target/LoongArch/LoongArchAvoidStoreForwardingBlocks.cpp
+13-2llvm/lib/Target/LoongArch/LoongArch.h
+2-2llvm/lib/Target/LoongArch/LoongArchTargetMachine.cpp
+2-0llvm/test/CodeGen/LoongArch/avoid-sfb.ll
+2-0llvm/lib/Target/LoongArch/LoongArchPassRegistry.def
+2-0llvm/lib/Target/LoongArch/LoongArchCodeGenPassBuilder.cpp
+96-411 files not shown
+97-417 files

LLVM/project fd11f4e — llvm/lib/Target/LoongArch LoongArchTargetMachine.cpp LoongArch.h, llvm/test/CodeGen/LoongArch opt-pipeline.ll avoid-sfb.ll

[LoongArch] Avoid store forwarding blocks in small copies

Store-to-load forwarding fails when a load is wider than the store that
wrote its bytes, for GPR, FPR, LSX and LASX accesses alike. On LA664 such
a load takes 14-17 cycles instead of 7-10.

Small memcpy/memmove are lowered to ld.d/st.d, fld.d/fst.d, vld/vst or
xvld/xvst copies. Add a pass that breaks such a copy into smaller copies
when its load is likely to read data from in-flight narrower stores:

- A narrower store shortly before the load writes inside the copied bytes
  through the same base register or frame index: break the copy around
  the store.
- In a loop, a store of the previous iteration of at least 8 bytes may
  write the same buffer, as in LZ77 back-reference copies: break the copy
  into 8-byte pieces.

The pass runs at -O1 and above and can be disabled with
-loongarch-disable-avoid-sfb.

    [6 lines not shown]
DeltaFile
+547-0llvm/lib/Target/LoongArch/LoongArchAvoidStoreForwardingBlocks.cpp
+315-50llvm/test/CodeGen/LoongArch/avoid-sfb.ll
+3-0llvm/lib/Target/LoongArch/LoongArchTargetMachine.cpp
+3-0llvm/lib/Target/LoongArch/LoongArch.h
+1-0llvm/utils/gn/secondary/llvm/lib/Target/LoongArch/BUILD.gn
+1-0llvm/test/CodeGen/LoongArch/opt-pipeline.ll
+870-501 files not shown
+871-507 files

LLVM/project 57d8117 — llvm/lib/Target/LoongArch LoongArchAvoidStoreForwardingBlocks.cpp

Use structured bindings in LoongArchAvoidSFB
DeltaFile
+5-7llvm/lib/Target/LoongArch/LoongArchAvoidStoreForwardingBlocks.cpp
+5-71 files

LLVM/project 5292695 — llvm/test/CodeGen/LoongArch avoid-sfb.ll

[LoongArch][NFC] Pre-commit tests for store forwarding blocks in copies

Small copies whose load reads data from in-flight narrower stores,
including LZ77-style overlapping copy loops reduced from the rustc-perf
bufreader benchmark.
DeltaFile
+692-0llvm/test/CodeGen/LoongArch/avoid-sfb.ll
+692-01 files

LLVM/project a1541c0 — mlir/include/mlir/Interfaces InferIntRangeInterface.h, mlir/lib/Dialect/Arith/Transforms IntRangeOptimizations.cpp

[mlir][IntRange] Unwrap nested shaped value types

Update `ConstantIntRanges::getStorageBitwidth` to recursively unwrap
nested `ShapedType` containers that carry the `ValueSemantics` trait
(such as `tensor<...xvector<...xi32>>`), returning 0 for shaped types
without value semantics (such as `memref`).

This ensures a tensor type and its element type always agree on storage
bitwidth, enabling integer range inference to propagate through
`tensor.extract`, `tensor.from_elements`, `tensor.insert`, and
`tensor.splat` on tensors of integer vectors and removing the
`!isIntOrIndex()` workarounds introduced in 2c7efd6f6e1b.

Tighten `IntRangeOptimizations` to reject types with zero storage
bitwidth during constant materialization and to skip elementwise
narrowing when the immediate element type is not an integer or index.

Assisted-by: gemini-4-carbon
DeltaFile
+49-13mlir/test/Dialect/Tensor/int-range-inference.mlir
+36-0mlir/unittests/Interfaces/InferIntRangeInterfaceTest.cpp
+19-6mlir/lib/Dialect/Arith/Transforms/IntRangeOptimizations.cpp
+2-18mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
+16-0mlir/test/Dialect/Arith/int-range-narrowing.mlir
+5-3mlir/include/mlir/Interfaces/InferIntRangeInterface.h
+127-401 files not shown
+132-427 files

LLVM/project 2a6b1a8 — mlir/lib/Dialect/Arith/Transforms IntRangeOptimizations.cpp, mlir/test/Dialect/Arith int-range-narrowing.mlir

[mlir][arith] Narrow arith.select via int ranges

Add a `NarrowSelect` pattern to `populateIntRangeNarrowingPatterns` so
`arith-int-range-narrowing` narrows `arith.select` operations over
signless integer or index scalars, vectors, and tensors when both arms
and the result fit in a narrower target bitwidth under a common signed
or unsigned extension.

`NarrowElementwise` requires all operands to share the result type and
therefore skips `arith.select` due to its `i1` condition operand,
leaving redundant widen/truncate pairs around selects inside narrowed
arithmetic chains.

Assisted-by: gemini-4-carbon
DeltaFile
+96-0mlir/test/Dialect/Arith/int-range-narrowing.mlir
+67-2mlir/lib/Dialect/Arith/Transforms/IntRangeOptimizations.cpp
+163-22 files

LLVM/project 6573dd3 — clang/lib/Sema SemaDecl.cpp SemaDeclAttr.cpp, clang/test/CodeGen pragma-weak.c

[Clang][Sema] Accept weak reference after declaration (#228809)

GCC accepts a weak reference even after there is a declaration. In here,
we use Check*Decl to do the required check and merge the NewDecl to
declaration chain.

Assisted-by: Claude # Tests ReleaseNote
Fixes: #56760
DeltaFile
+47-0clang/test/Sema/pragma-weak.c
+37-0clang/test/CodeGen/pragma-weak.c
+29-6clang/lib/Sema/SemaDeclAttr.cpp
+19-2clang/test/SemaCXX/pragma-weak.cpp
+13-0clang/lib/Sema/SemaDecl.cpp
+12-0clang/test/CodeGenCXX/pragma-weak.cpp
+157-82 files not shown
+166-88 files

LLVM/project b37a115 — llvm/lib/Transforms/InstCombine InstCombineCalls.cpp, llvm/test/Transforms/InstCombine ldexp.ll

[InstCombine] Respect input denormal mode when folding ldexp (#247219)

InstCombine folds `ldexp(x, K)` into `fmul x, 2^K`. When `2^K` is
subnormal and the function's input denormal mode is not IEEE, the
multiply flushes the constant to zero so the result becomes zero instead
of the correctly scaled value.

We'd skip the fold in that case. The fold is unchanged under the default
IEEE mode and for normal scale factors.

Fixes #238186.
DeltaFile
+80-0llvm/test/Transforms/InstCombine/ldexp.ll
+4-2llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+84-22 files

LLVM/project fa05da9 — clang/lib/CodeGen CGExprScalar.cpp, clang/test/CodeGen enum-bool.c

[clang] Do not use atomicrmw for compound assignment to a bool enumeration (#245856)

Fixes #245854.

`EmitCompoundAssignLValue()` allows `atomicrmw` for integer-like types
that are
not `_Bool`, so an enumeration with a fixed bool underlying type is
updated as a
plain integer and never renormalized to the bool representation:

```c
_Atomic enum E : bool { F, T } b;
b += 2;   /* gives 0 at -O2, expected 1 (both are 1 at -O0) */
```

The IR is `atomicrmw add i8 2`, which leaves the object representation
as 2.
`b |= 2` is affected in the same way.


    [6 lines not shown]
DeltaFile
+5-0clang/test/CodeGen/enum-bool.c
+2-2clang/lib/CodeGen/CGExprScalar.cpp
+7-22 files

LLVM/project 087babd — llvm/lib/Target/AMDGPU MIMGInstructions.td

[AMDGPU] Factor common tensor pseudo flags into VIMAGE_TENSOR_Pseudo_Base, NFC (#247300)
DeltaFile
+10-7llvm/lib/Target/AMDGPU/MIMGInstructions.td
+10-71 files

LLVM/project 23807a4 — lld/ELF/Arch SPARCV9.cpp, lld/test/ELF sparcv9-plt.s

[lld][ELF][SPARC] Use the PLT for R_SPARC_WDISP30 calls (#246805)

Non-PIC code uses R_SPARC_WDISP30 for a call. It was handled as a plain
PC-relative reference, so a call to a function in a shared object got a
canonical PLT entry, a call to a protected function failed with "cannot
preempt symbol", and -shared rejected the call.

Handle R_SPARC_WDISP30 like R_SPARC_WPLT30. R_SPARC_WDISP30 is only used
by call, which never takes the function's address, so a non-canonical
PLT entry is enough.

This differs from GNU ld on purpose. GNU ld gives such functions
canonical PLT entries in an executable, and with -shared it emits
dynamic R_SPARC_WDISP30 relocations, which need DT_TEXTREL.

Assisted-by: Claude

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+8-0lld/test/ELF/sparcv9-plt.s
+2-2lld/ELF/Arch/SPARCV9.cpp
+10-22 files

LLVM/project db7fe40 — clang/lib/AST/ByteCode Compiler.h Compiler.cpp

[clang][bytecode] Split up registering locals (#247160)

Split it into allocating the local and registering it in the
`VariableScope`. In the future, we will need to know if evaluating the
initializer failed before registering the local.
DeltaFile
+52-29clang/lib/AST/ByteCode/Compiler.cpp
+6-0clang/lib/AST/ByteCode/Compiler.h
+58-292 files

LLVM/project 4d5b716 — flang/test/Driver offload-arch-tool.f90, flang/test/Driver/Inputs/nvptx-arch nvptx_arch_sm_70

use an Inputs/ file for the script
DeltaFile
+1-13flang/test/Driver/offload-arch-tool.f90
+3-0flang/test/Driver/Inputs/nvptx-arch/nvptx_arch_sm_70
+4-132 files

LLVM/project 21f6d0e — mlir/lib/Dialect/Vector/IR VectorOps.cpp, mlir/test/Dialect/Vector canonicalize.mlir

[mlir][vector] Do not fold contiguous gather/scatter on non-unit strides (#241601)

`FoldContiguousGather` and `FoldContiguousScatter` rewrite a
gather/scatter with indices `[0, 1, ...]` into
`vector.maskedload`/`vector.maskedstore` without checking the memref
layout. When the most minor memref dim has a non-unit stride, the result
fails verification.

This patch skips the fold unless `vector::isValidLoadStoreMemRefLayout`
(added in #241579) accepts the layout, so single-element gathers still
fold.

Fixes #240189

Assisted-by: Claude Opus 5.5
DeltaFile
+63-0mlir/test/Dialect/Vector/canonicalize.mlir
+12-2mlir/lib/Dialect/Vector/IR/VectorOps.cpp
+75-22 files

LLVM/project 2d64223 — llvm/test/CodeGen/AMDGPU srem.ll load-global-i8.ll, llvm/test/CodeGen/ARM constant-islands-convergence.mir

Merge remote-tracking branch 'llvm-src/main' into users/aokblast/clang/sema_accept_weak_after_decl
DeltaFile
+2,602-2,926llvm/test/CodeGen/X86/vector-compress.ll
+0-5,395llvm/test/CodeGen/AMDGPU/load-global-i8.ll
+0-5,274llvm/test/CodeGen/AMDGPU/srem.ll
+4,635-0llvm/test/CodeGen/ARM/constant-islands-convergence.mir
+4,302-0llvm/test/CodeGen/RISCV/GlobalISel/atomicrmw-max-min-umax-umin.ll
+1,356-2,712llvm/test/MC/RISCV/corev/XCVsimd-invalid.s
+12,895-16,3074,466 files not shown
+219,275-164,0484,472 files

LLVM/project ce85f8b — llvm/lib/Target/Mips/Disassembler MipsDisassembler.cpp, llvm/test/TableGen RegClassByHwMode.td

[nspr] initial commit
DeltaFile
+90-0llvm/test/TableGen/DecoderEmitter/regclass-by-hwmode.td
+31-16llvm/utils/TableGen/DecoderEmitter.cpp
+0-27llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp
+2-5llvm/test/TableGen/RegClassByHwMode.td
+123-484 files

LLVM/project 44b8fe4 — llvm/lib/Target/RISCV/Disassembler RISCVDisassembler.cpp, llvm/test/TableGen/DecoderEmitter regclass-by-hwmode.td

[nspr] initial commit
DeltaFile
+77-0llvm/test/TableGen/DecoderEmitter/regclass-by-hwmode.td
+40-20llvm/utils/TableGen/DecoderEmitter.cpp
+0-11llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
+117-313 files

LLVM/project db86638 — llvm/lib/Target/RISCV RISCVInstrInfoY.td, llvm/lib/Target/RISCV/Disassembler RISCVDisassembler.cpp

[nspr] update
DeltaFile
+6-7llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
+7-4llvm/lib/Target/RISCV/RISCVInstrInfoY.td
+13-112 files

LLVM/project 6fcce91 — llvm/lib/Target/Hexagon HexagonDepIICScalar.td, llvm/test/CodeGen/AMDGPU amdgcn.bitcast.512bit.ll amdgcn.bitcast.1024bit.ll

Rebase onto origin/main

Created using spr 2.0.0-beta.2
DeltaFile
+91,987-94,489llvm/test/CodeGen/AMDGPU/amdgcn.bitcast.1024bit.ll
+26,556-27,657llvm/test/CodeGen/AMDGPU/amdgcn.bitcast.512bit.ll
+15,800-13,586llvm/lib/Target/Hexagon/HexagonDepIICScalar.td
+29,293-0llvm/test/CodeGen/X86/vector-interleave7-i16.ll
+29,228-0llvm/test/CodeGen/X86/vector-interleaved7-i8.ll
+27,225-0llvm/test/CodeGen/X86/vector-interleave7-i32.ll
+220,089-135,73231,619 files not shown
+2,663,759-1,103,55831,625 files

LLVM/project c3b1603 — clang/lib/Sema SemaDeclAttr.cpp

fixup! [Clang][Smea] Accept weak reference after declaration
DeltaFile
+3-2clang/lib/Sema/SemaDeclAttr.cpp
+3-21 files

LLVM/project 7e44b79 — clang/lib/Sema SemaOpenMP.cpp, clang/test/OpenMP num_threads_num_teams_thread_limit_implicit_conversion.cpp

[Clang][OpenMP] Fix sema checks for thread_limit and num_teams list values
DeltaFile
+99-0clang/test/OpenMP/num_threads_num_teams_thread_limit_implicit_conversion.cpp
+12-15clang/lib/Sema/SemaOpenMP.cpp
+111-152 files