LLVM/project 217980b — llvm/lib/Target/AMDGPU AMDGPUMemoryUtils.cpp, llvm/test/CodeGen/AMDGPU promote-kernel-arguments.ll agpr-copy-no-free-registers.ll

[AMDGPU] Add cl option to respect acquires when inferring noclobber

The option is disabled by default, which effectively reverts #219991.
That is unsound and re-introduces miscompilations, but necessary as a temporary
measure to avoid performance regressions while we look into ways to recover
performance.
DeltaFile
+510-238llvm/test/CodeGen/AMDGPU/noclobber-barrier.ll
+158-162llvm/test/CodeGen/AMDGPU/agpr-copy-no-free-registers.ll
+27-13llvm/test/CodeGen/AMDGPU/promote-kernel-arguments.ll
+15-3llvm/lib/Target/AMDGPU/AMDGPUMemoryUtils.cpp
+710-4164 files

LLVM/project 21c85ff — llvm/lib/Target/AMDGPU VOPInstructions.td VOP3PInstructions.td, llvm/lib/Target/AMDGPU/Utils AMDGPUBaseInfo.h AMDGPUBaseInfo.cpp

[AMDGPU] Describe MFMAs with a variant in MAIInstInfoTable (NFC) (#244159)

- Add an MFMAVariant enum. Each MFMA pseudo gets its variant from
  MAIInstInfoTable, a TableGen GenericTable. Each real MFMA opcode
  inherits the variant of its pseudo through VOP3P_Real.
- Look up an MFMA's co-execution info by its variant, as gfx1250 does
  for WMMA, instead of matching every opcode.
- Replace the is_dgemm and is_gfx940_xdl fields with the variant.
- Describe each MFMA row by the first stage at which SALU, memory, VALU
  and the next MFMA may issue, plus the window length.

Assisted-by: Claude Opus 5.5
DeltaFile
+62-308llvm/lib/Target/AMDGPU/AMDGPUCoExecSchedStrategy.cpp
+76-33llvm/lib/Target/AMDGPU/VOP3PInstructions.td
+28-2llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
+23-2llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
+20-0llvm/unittests/Target/AMDGPU/MFMACoExecRules.cpp
+10-1llvm/lib/Target/AMDGPU/VOPInstructions.td
+219-3466 files

LLVM/project a0feb1d — llvm/lib/Target/Hexagon HexagonGlobalSchedulerV2.cpp, llvm/test/CodeGen/AArch64 sve-fixed-length-masked-expandloads.ll

Merge branch 'main' into users/chfast/dag-abs-poison
DeltaFile
+5,269-0llvm/lib/Target/Hexagon/HexagonGlobalSchedulerV2.cpp
+722-262llvm/test/Transforms/LoopUnroll/RISCV/outer-loop-unroll-threshold.ll
+368-368llvm/test/MC/Disassembler/AMDGPU/gfx10_smem.txt
+336-336llvm/test/MC/AMDGPU/gfx10_asm_smem.s
+525-0llvm/test/CodeGen/Hexagon/pullv2-hvx-cur-load.mir
+178-290llvm/test/CodeGen/AArch64/sve-fixed-length-masked-expandloads.ll
+7,398-1,256426 files not shown
+18,767-6,231432 files

LLVM/project f59521e — libcxx/include/__new allocation_result.h new_at_least.h, libcxx/src/support new.ipp

[libc++] Add __new_at_least (#215813)

This adds a variant for `operator new` (spelled as `__new_at_least`,
since this is a library-internal extension) that returns the number of
objects actually allocated. It is being used in
`std::allocator::allocate_at_least`, which then allows `vector` and
`string` to make use of any over-allocations.

Fixes #212790
DeltaFile
+111-0libcxx/test/libcxx/language.support/support.dynamic/new_at_least.pass.cpp
+88-0libcxx/src/support/new.ipp
+73-0libcxx/test/libcxx/language.support/support.dynamic/new_at_least.replace.pass.cpp
+72-0libcxx/test/libcxx/language.support/support.dynamic/new_at_least.align_val_t.replace.pass.cpp
+63-0libcxx/include/__new/new_at_least.h
+33-0libcxx/include/__new/allocation_result.h
+440-028 files not shown
+566-6134 files

LLVM/project 51da893 — llvm/lib/CodeGen/MIRParser MIRParser.cpp, llvm/test/CodeGen/MIR/X86 instr-num-after-substitutions.mir

[MIR] Avoid reusing debug instruction numbers after parsing (#244437)

When a pass allocates a debug instruction number after MIR parsing, it
can get a number that is still in use. Resuming code generation from MIR
can expose this in two ways:

- X86FixupBWInsts, given the substitution 2 -> 1 and only instruction 1,
numbers its replacement 2 and records 1 -> 2. The substitutions now form
the cycle 2 -> 1 -> 2, and LiveDebugValues follows it forever when a
DBG_INSTR_REF reaches it.
- Given a DBG_INSTR_REF to a deleted instruction 2, the same rewrite
numbers its load 2, and LiveDebugValues gives the variable the load's
value instead of no location.

The parser seeds the counter only from the numbers that top-level
instructions carry. It now also counts the numbers on bundled
instructions, DBG_PHI operands, DBG_INSTR_REF operands and
debugValueSubstitutions entries.

This turned up while teaching X86FixupBWInsts to widen MOV16ri, which
made llc hang on dbg-value-superreg-copy2.mir.
DeltaFile
+80-0llvm/test/CodeGen/MIR/X86/instr-num-after-substitutions.mir
+40-0llvm/test/DebugInfo/MIR/InstrRef/dangling-ref-after-parse.mir
+21-5llvm/lib/CodeGen/MIRParser/MIRParser.cpp
+1-1llvm/test/DebugInfo/MIR/InstrRef/memory-operand-load-folding.mir
+142-64 files

LLVM/project 2647954 — llvm/lib/Target/AArch64 AArch64ISelLowering.cpp, llvm/test/CodeGen/AArch64 sve-streaming-mode-fixed-length-masked-gather-scatter.ll sve-fixed-length-extract-subvector.ll

[AArch64] Improve fixed-length constant splats (#247571)

Don't lower build-vector splats generated as part of lowering,
as those are transformed into splat_vector by the dagcombiner.

I noticed this when reviewing #246021
DeltaFile
+178-290llvm/test/CodeGen/AArch64/sve-fixed-length-masked-expandloads.ll
+0-30llvm/test/CodeGen/AArch64/sve-fixed-length-extract-subvector.ll
+6-1llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+1-2llvm/test/CodeGen/AArch64/sve-streaming-mode-fixed-length-masked-gather-scatter.ll
+185-3234 files

LLVM/project ff796eb — llvm/test/CodeGen/X86 combine-abs.ll

[X86] Use named values in the new combine-abs.ll tests

Assisted-by: Claude Code (Claude Opus 5.5)
DeltaFile
+10-10llvm/test/CodeGen/X86/combine-abs.ll
+10-101 files

LLVM/project 827932e — llvm/lib/Target/X86 X86ISelLowering.cpp, llvm/test/CodeGen/X86 rotate-extract-vector.ll vector-mul.ll

[X86] Add X86ISD::PMULUDQ poison handling (#247578)

canCreateUndefOrPoisonForTargetNode - X86ISD::PMULUDQ multiplies the
low 32 bits of each element into a 64-bit product, which can't
overflow, so it can't create undef/poison.

#245048 needs this to drop the movq in vzext_movl_pmuludq.

Assisted-by: Claude Code (Claude Opus 5.5)
DeltaFile
+50-0llvm/test/CodeGen/X86/vector-mul.ll
+2-2llvm/test/CodeGen/X86/rotate-extract-vector.ll
+1-0llvm/lib/Target/X86/X86ISelLowering.cpp
+53-23 files

LLVM/project dc44ae6 — llvm/lib/CodeGen/SelectionDAG DAGCombiner.cpp, llvm/test/CodeGen/AMDGPU extract-load-i1.ll extract_vector_dynelt_subbyte.ll

[DAGCombiner] Scalarize variable index extracts from sub byte vectors

The type legalizer lowers a variable index extract from an illegal
vector with sub byte elements through the stack, storing one byte per
element. When the vector comes from a bitcast on a little endian
target, element $i$ occupies bits $[i \cdot w, (i+1) \cdot w)$ of the
source, so extract it with a shift of the integer word holding it.

```
t3: v64i1 = bitcast t2
t5: i1 = extract_vector_elt t3, t4
  -->
t6: i64 = bitcast t2
t7: i64 = srl t6, t4
t5: i1 = truncate t7
```

On gfx1200 this replaces 64 scratch stores and a scratch load with a
few VALU instructions. Byte sized elements, non bitcast sources and
non power of 2 sizes are left unchanged.
DeltaFile
+85-1,370llvm/test/CodeGen/AMDGPU/extract_vector_dynelt_subbyte.ll
+88-0llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+1-23llvm/test/CodeGen/AMDGPU/extract-load-i1.ll
+174-1,3933 files

LLVM/project 22c3bdb — llvm/test/CodeGen/AMDGPU extract_vector_dynelt_subbyte.ll

[AMDGPU] Add tests for dynamic extract from sub byte element vectors. NFC

A dynamic extract from an illegal vector of i1/i2/i4 elements can be
lowered to a word select and shift instead of going through scratch.
Cover several widths, uniform and divergent indices, SelectionDAG and
GlobalISel, and negative cases.
DeltaFile
+2,565-0llvm/test/CodeGen/AMDGPU/extract_vector_dynelt_subbyte.ll
+2,565-01 files

LLVM/project 74951bd — llvm/test/CodeGen/X86 pr244806.ll

[X86] Add test coverage for #244806 (#247585)

Pulled out of #245066 - original test by schizophrenicmaniac
DeltaFile
+54-0llvm/test/CodeGen/X86/pr244806.ll
+54-01 files

LLVM/project f5692d3 — llvm/lib/Target/AArch64 AArch64TargetTransformInfo.cpp, llvm/test/Analysis/CostModel/AArch64 shuffle-other.ll

[AArch64] Cost narrow two-source shuffles as the widened legal shuffle (#241908)

Widen the mask of a narrow two-source shuffle to the legal type and cost
that, as is done for length-changing shufflevectors. 

Assisted-By: Claude Code Opus 5
DeltaFile
+25-0llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
+10-10llvm/test/Analysis/CostModel/AArch64/shuffle-other.ll
+5-4llvm/test/Transforms/VectorCombine/AArch64/shuffle-of-intrinsics.ll
+40-143 files

LLVM/project c3f51ca — llvm/lib/Target/RISCV RISCVTargetTransformInfo.cpp, llvm/test/Transforms/LoopUnroll/RISCV outer-loop-unroll-threshold.ll

[RISCV] Do not partially unroll outer loops with a known trip count (#247073)

Follow-up to #244182, which lowered the full-unroll threshold for
outer loops.

Fully unrolling an outer loop is limited to the partial-unroll budget
because it duplicates the inner loops. Partial unrolling duplicates
them as well, so disable it for outer loops with a known trip count.

Loops with an unknown trip count are left unchanged: lowering their
budget as well shrinks llvm-test-suite by less than 0.2% more while
changing 50 translation units.

With -mcpu=sifive-p670 -O3, llvm-test-suite shrinks by 579 KB (2.9%)
across 77 translation units, with fewer GPR spills and reloads.

Assisted-by: TRAE CLI (GLM-5.4)
DeltaFile
+722-262llvm/test/Transforms/LoopUnroll/RISCV/outer-loop-unroll-threshold.ll
+7-1llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+729-2632 files

LLVM/project 25587c1 — lldb/packages/Python/lldbsuite/test_event build_exception.py, lldb/test/API/test_utils/base TestBaseTest.py

[lldb][test] Print exit code when build command fails (#247580)

On some macOS nodes, our Make commands randomly fail with no output.

This patch adds the error code of the test build to the test output, so
we at least know what signal killed it.

assisted-by: claude
DeltaFile
+5-4lldb/packages/Python/lldbsuite/test_event/build_exception.py
+2-0lldb/test/API/test_utils/base/TestBaseTest.py
+7-42 files

LLVM/project daa651f — llvm/test/CodeGen/X86 vector-fshr-sub128.ll vector-fshl-sub128.ll

[X86] Update tests for SlotIndexes compaction

The rebase onto eeee317b1f30 left four tests with upstream's checks
and a stale merge of pdep-vector-128.ll, and missed the new
pr246251.ll. Regenerate them with compaction on; each one's
compaction-off regeneration matches upstream, so only allocation
changes.
DeltaFile
+271-271llvm/test/CodeGen/X86/vector-shift-lut.ll
+118-118llvm/test/CodeGen/X86/pr246251.ll
+80-80llvm/test/CodeGen/X86/vector-fshr-512.ll
+38-38llvm/test/CodeGen/X86/pdep-vector-128.ll
+18-18llvm/test/CodeGen/X86/vector-fshr-sub128.ll
+18-18llvm/test/CodeGen/X86/vector-fshl-sub128.ll
+543-5436 files

LLVM/project 4170cb6 — llvm/lib/Analysis ScalarEvolution.cpp, llvm/test/Analysis/ScalarEvolution minmax-decomposition-guards.ll

[SCEV] Prove min/max Pred RHS and LHS Pred min/max via decomposition. (#208546)

Try to prove "LHS Pred RHS" by decomposing a min/max on either side into
its operands, proving the per-operand comparisons. A min/max equals one
of its operands, so proving the comparison for all of them proves it:

    minmax(X0, ..., Xn) Pred RHS  if  Xi Pred RHS for all i, and
    LHS Pred minmax(Y0, ..., Yn)  if  LHS Pred Yi for all i.

For LT/LE predicates with matching signedness, one operand is
sufficient:

    min(X0, ..., Xn) Pred RHS  if  Xi Pred RHS for some i, and
    LHS Pred max(Y0, ..., Yn)  if  LHS Pred Yi for some i.

The new helper also replaces the custom min/max logic in
IsKnownPredicateViaMinOrMax.

This is used in isKnownViaNonRecursiveReasoning. To avoid recursion in

    [14 lines not shown]
DeltaFile
+258-24llvm/test/Analysis/ScalarEvolution/minmax-decomposition-guards.ll
+90-15llvm/test/Transforms/LoopVectorize/early-exit-minmax-trip-count.ll
+75-17llvm/test/Transforms/LoopVectorize/single-early-exit-deref-assumptions.ll
+67-24llvm/lib/Analysis/ScalarEvolution.cpp
+48-0llvm/test/Transforms/IndVarSimplify/eliminate-comparison.ll
+538-805 files

LLVM/project a18bf56 — llvm/docs PointerAuth.md

[Docs] Add documentation for ptrauth ELF module flags (#237916)

There are four module flags that influence code-generation for PAuthABI
on ELF platforms.

ptrauth-elf-got
ptrauth-init-fini
ptrauth-init-fini-address-discrimination
ptrauth-sign-personality

Although largely self-explanatory, add a section in the documentation to
collect all the available module flags.

The ptrauth-init-fini module flags will work on the Mach-O equivalents,
but they are intended only to be used on ELF platforms.
DeltaFile
+20-0llvm/docs/PointerAuth.md
+20-01 files

LLVM/project 34385a9 — clang/lib/CIR/Dialect/Transforms CIRForwardReturnSlot.cpp, clang/test/CIR/CodeGen unary.cpp

[CIR] Return the value stored to the return slot directly (#246252)

Classic codegen returns the value stored to the return slot directly
when that store dominates the return, and then drops the slot
(`findDominatingStoreToReturnValue` in CGCall.cpp). CIR always lowered
the slot to an alloca, store, load and ret, so most functions returning
a scalar differed from classic codegen.

This adds a `cir-forward-return-slot` function pass. In a function with
a single `cir.return` of a load from the return slot, it returns the
stored value directly when either:
- the store is the slot's only other use and reaches the load through a
chain of single predecessors, or
- the store immediately precedes the load.

These are classic codegen's rules. Volatile, atomic, record, array and
complex slots are left alone. The return keeps its own location, which
CIRGen already sets to the return statement's.


    [5 lines not shown]
DeltaFile
+101-213clang/test/CIR/CodeGenBuiltins/X86/avx512bw-builtins.c
+37-253clang/test/CIR/CodeGenBuiltins/X86/avx512f-builtins.c
+254-0clang/test/CIR/Transforms/forward-return-slot.cir
+44-187clang/test/CIR/CodeGen/unary.cpp
+175-0clang/lib/CIR/Dialect/Transforms/CIRForwardReturnSlot.cpp
+6-163clang/test/CIR/CodeGenBuiltins/builtin-object-size.c
+617-81696 files not shown
+987-2,285102 files

LLVM/project ecca806 — llvm/lib/Target/AMDGPU VOPInstructions.td VOP3PInstructions.td, llvm/lib/Target/AMDGPU/Utils AMDGPUBaseInfo.h AMDGPUBaseInfo.cpp

[AMDGPU] Describe MFMAs with a variant in MAIInstInfoTable (NFC)

- Add an MFMAVariant enum. Each MFMA pseudo gets its variant from
  MAIInstInfoTable, a TableGen GenericTable. Each real MFMA opcode
  inherits the variant of its pseudo through VOP3P_Real.
- Look up an MFMA's co-execution info by its variant, as gfx1250 does
  for WMMA, instead of matching every opcode.
- Replace the is_dgemm and is_gfx940_xdl fields with the variant.
- Describe each MFMA row by the first stage at which SALU, memory, VALU
  and the next MFMA may issue, plus the window length.

Assisted-by: Claude Opus 5.5

DeltaFile
+62-308llvm/lib/Target/AMDGPU/AMDGPUCoExecSchedStrategy.cpp
+76-33llvm/lib/Target/AMDGPU/VOP3PInstructions.td
+28-2llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
+23-2llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
+20-0llvm/unittests/Target/AMDGPU/MFMACoExecRules.cpp
+10-1llvm/lib/Target/AMDGPU/VOPInstructions.td
+219-3466 files

LLVM/project ba6c613 — clang/test/CIR/Transforms offload-opt-pipeline.hip dead-kernel-elimination.cu

[CIR] Add end-to-end tests for the offload passes

Compile real CUDA and HIP host and device code to CIR, combine it with
cir-offload-merge -combine -opt and check dead kernel elimination,
kernel argument constant propagation and launch bounds on the result.
The CUDA test also splits the container and lowers the host module with
a device binary to check that the kernel is registered.
DeltaFile
+44-0clang/test/CIR/Transforms/offload-opt-pipeline.cu
+33-0clang/test/CIR/Transforms/dead-kernel-elimination.cu
+33-0clang/test/CIR/Transforms/dead-kernel-elimination.hip
+24-0clang/test/CIR/Transforms/offload-opt-pipeline.hip
+134-04 files

LLVM/project d0f0136 — clang/lib/CIR/FrontendAction CIRGenAction.cpp, clang/test/CIR/CodeGenCUDA resume-device-binary.cu

[CIR][CUDA] Attach the device binary when resuming a host .cir module

CIRGen records the device binary named by -foffload-include-binary on a
CUDA/HIP host module. A host module emitted before the device binary
existed, as in the offload-merge pipeline, never runs CIRGen again. Read
the binary when cc1 resumes such a module, so that LoweringPrepare
registers its kernels.
DeltaFile
+45-0clang/test/CIR/CodeGenCUDA/resume-device-binary.cu
+35-0clang/lib/CIR/FrontendAction/CIRGenAction.cpp
+80-02 files

LLVM/project 03f5b63 — clang/include/clang/Driver Action.h, clang/lib/Driver Action.cpp Driver.cpp

[Driver] Add a ClangIR offload-merge pipeline for CUDA and HIP

With -fclangir --clangir-offload-merge, the host and each device are
compiled to pristine CIR, combined into one offload container with
cir-offload-merge -combine -opt, and split back with -split. Each split
module then resumes from -x cir: device modules are lowered to PTX (or
bitcode for HIP), packaged into the fat binary, and the host module
embeds it with -foffload-include-binary.

CIRMergeJobAction and CIRSplitJobAction record the tool chain, bound
arch and offload kind of each module. The split outputs are named the
way cir-offload-merge -split names them, <prefix>-<kind>-<triple>.cir
with an index for modules that share a triple, and cached per target so
each consumer gets its module.

-fno-clangir-offload-merge-pointer-facts turns off the pointer facts
pass in the merge step.
DeltaFile
+340-16clang/lib/Driver/Driver.cpp
+98-0clang/test/Driver/cir-offload-merge.cu
+84-0clang/include/clang/Driver/Action.h
+73-0clang/test/Driver/cir-offload-merge.hip
+51-1clang/lib/Driver/ToolChains/Clang.cpp
+38-4clang/lib/Driver/Action.cpp
+684-214 files not shown
+726-2110 files

LLVM/project 7db1427 — clang/lib/CIR/Dialect/Transforms/OffloadOpt PointerFacts.cpp, clang/test/CIR/Transforms pointer-facts-attribution.cir offload-pointer-facts-lifetimes.cir

[CIR] Add a launch-derived pointer facts pass for offload containers

cir-offload-pointer-facts derives facts about the pointer parameters of a
device kernel from its host launches and attaches them to the
parameters. The only fact today is llvm.noalias: at every launch the
pointer arguments come from distinct cudaMalloc allocations, and the
kernel reaches each buffer only through its parameter (no address-taken
global, loaded pointer, forwarded value, escape or in-kernel allocation).

The proof is kernel-wide and conservative: one unprovable launch or body
path drops every fact for that kernel. Unchecked allocations are
accepted, since a failed cudaMalloc makes the launch undefined; only a
free before the launch invalidates a slot. The pass reports statistics
and remarks with a reason for each rejection.
DeltaFile
+900-0clang/test/CIR/Transforms/pointer-facts.cir
+670-0clang/lib/CIR/Dialect/Transforms/OffloadOpt/PointerFacts.cpp
+606-0clang/test/CIR/Transforms/offload-pointer-facts.cir
+535-0clang/test/CIR/Transforms/offload-pointer-facts-callees.cir
+365-0clang/test/CIR/Transforms/offload-pointer-facts-lifetimes.cir
+120-0clang/test/CIR/Transforms/pointer-facts-attribution.cir
+3,196-07 files not shown
+3,452-013 files

LLVM/project 647612f — clang/include/clang/CIR/Dialect/IR CIROps.td, clang/lib/CIR/Dialect/IR CIRDialect.cpp

[CIR] Fold cir.if with a constant condition

Splice the taken region of a cir.if whose condition is a constant and
drop the op. Only single-block bodies terminated by cir.yield fold.
DeltaFile
+83-0clang/test/CIR/Transforms/if-fold.cir
+74-0clang/lib/CIR/Dialect/IR/CIRDialect.cpp
+0-15clang/test/CIR/CodeGen/loop-cond-cleanup.cpp
+1-1clang/lib/CIR/Dialect/Transforms/CIRCanonicalize.cpp
+1-0clang/include/clang/CIR/Dialect/IR/CIROps.td
+159-165 files

LLVM/project edf81be — clang/test/CIR/Tools cir-offload-pointer-facts.cir cir-offload-pointer-facts-dominance.cir, clang/test/CIR/Transforms pointer-facts.cu

[CIR] Run the offload passes from cir-offload-merge -combine -opt

With -opt, combine runs mem2reg and sccp on each nested module, so that
launch arguments reach the stub calls as constants, and then dead kernel
elimination, kernel argument constant propagation, launch bounds
propagation and pointer facts on the container. -disable-cir-prop-kernel-args,
-disable-cir-infer-launch-bounds and -no-pointer-facts turn off the
individual passes.
DeltaFile
+302-0clang/test/CIR/Tools/cir-offload-pointer-facts-dominance.cir
+47-0clang/test/CIR/Transforms/pointer-facts.cu
+46-0clang/test/CIR/Tools/cir-offload-pointer-facts.cir
+29-0clang/tools/cir-offload-merge/cir-offload-merge.cpp
+8-0clang/tools/cir-offload-merge/Opts.td
+3-0clang/tools/cir-offload-merge/CMakeLists.txt
+435-06 files

LLVM/project 145d4a9 — clang/include/clang/CIR/Dialect Passes.h Passes.td, clang/lib/CIR/Dialect/Transforms/OffloadOpt CMakeLists.txt LaunchBoundsPropagation.cpp

[CIR] Add launch bounds propagation for offload containers

When every launch of a kernel is visible and uses a compile-time block
size, record the largest block size on the device kernel as
nvvm.maxntid, the bound the user could have written with
__launch_bounds__. This lets ptxas budget registers against the real
block size instead of the 1024-thread ceiling.

All launches must be visible, on the same terms as kernel argument
constant propagation, because a launch that exceeds maxntid fails. An
existing bound is only tightened. Kernels for targets other than NVPTX
are left alone.
DeltaFile
+186-0clang/test/CIR/Transforms/launch-bounds-propagation.cir
+132-0clang/lib/CIR/Dialect/Transforms/OffloadOpt/LaunchBoundsPropagation.cpp
+30-0clang/include/clang/CIR/Dialect/Passes.td
+4-0clang/tools/cir-opt/cir-opt.cpp
+1-0clang/lib/CIR/Dialect/Transforms/OffloadOpt/CMakeLists.txt
+1-0clang/include/clang/CIR/Dialect/Passes.h
+354-06 files

LLVM/project a0107bf — clang/include/clang/CIR/Dialect/IR CIRInlinerInterface.h, clang/lib/CIR/Dialect/IR CMakeLists.txt CIRInlinerInterface.cpp

[CIR] Add a CIR dialect inliner interface

Add CIRInlinerInterface to the dialect library, exposed through
cir::registerInlinerInterface(registry), and register it in cir-opt.
Legality is conservative:
- launch markers (calls carrying cu.kernel_name) stay calls, because the
  offload passes rebuild the kernel binding table from them;
- only single-block bodies ending in cir.return are accepted, because the
  generic inliner models a callable's results through that terminator.

The registration also registers the LLVM and func dialects' inliner
extensions. Both dialects promise DialectInlinerInterface, and the
inliner aborts on a promised interface that was never registered.
DeltaFile
+88-0clang/lib/CIR/Dialect/IR/CIRInlinerInterface.cpp
+35-0clang/include/clang/CIR/Dialect/IR/CIRInlinerInterface.h
+6-0clang/tools/cir-opt/cir-opt.cpp
+3-1clang/test/CIR/Transforms/inline-indirect-call.cir
+3-0clang/lib/CIR/Dialect/IR/CMakeLists.txt
+135-15 files

LLVM/project 83c7ae7 — clang/include/clang/CIR/Dialect/Transforms/OffloadOpt KernelBindingTable.h, clang/lib/CIR/Dialect/Transforms/OffloadOpt KernelBindingTable.cpp

[CIR] Trace coerced and inlined dim3 launch geometry

On x86_64 the dim3 arguments of __cudaPushCallConfiguration arrive
coerced to integer pairs, and once dim3's constructor is inlined its
fields are stored one by one. Trace both shapes in KernelBindingTable so
launches get their geometry.
DeltaFile
+154-15clang/lib/CIR/Dialect/Transforms/OffloadOpt/KernelBindingTable.cpp
+133-1clang/test/CIR/Analysis/kernel-bindings.cir
+3-1clang/include/clang/CIR/Dialect/Transforms/OffloadOpt/KernelBindingTable.h
+290-173 files

LLVM/project b1daf93 — clang/test/CIR/Analysis kernel-bindings.cir, clang/test/CIR/lib/Analysis CMakeLists.txt TestKernelBindings.cpp

[CIR] Add a test-print-kernel-bindings pass to cir-opt

Print the KernelBindingTable of an offload container: each kernel with
its host stub, its device definitions and its launch sites.
DeltaFile
+51-0clang/test/CIR/Analysis/kernel-bindings.cir
+48-0clang/test/CIR/lib/Analysis/TestKernelBindings.cpp
+2-0clang/tools/cir-opt/cir-opt.cpp
+2-0clang/test/CIR/lib/Analysis/CMakeLists.txt
+103-04 files

LLVM/project ac219e0 — clang/include/clang/CIR/Dialect/Transforms/OffloadOpt KernelCloning.h, clang/lib/CIR/Dialect/Transforms/OffloadOpt CMakeLists.txt KernelCloning.cpp

[CIR] Add kernel cloning helpers for offload containers

KernelCloning creates a specialized copy of a kernel and redirects a
chosen set of launch sites at it. The original is always kept: the
runtime can reach a kernel by name through hipModuleGetFunction and
similar, so rewriting a kernel defined in the source program in place is
unsound even when every launch in this module is visible. A kernel is
only taken over when all its users are among the redirected sites.

Signed-off-by: Steffen Holst Larsen <sholstla at amd.com>
DeltaFile
+186-0clang/lib/CIR/Dialect/Transforms/OffloadOpt/KernelCloning.cpp
+78-0clang/include/clang/CIR/Dialect/Transforms/OffloadOpt/KernelCloning.h
+1-0clang/lib/CIR/Dialect/Transforms/OffloadOpt/CMakeLists.txt
+265-03 files