LLVM/project 9353eddllvm/docs LangRef.md, llvm/lib/CodeGen/SelectionDAG TargetLowering.cpp

[APFloat][SelectionDAG] Support Float8E5M3FNU in `convert.{to,from}.arbitrary.fp` (#216387)

Float8E5M3FNU was already accepted by the IR verifier, because
`isValidArbitraryFPFormat` is defined in terms of
`getArbitraryFPFormatSizeInBits` and that table covers it. It was
missing from `getArbitraryFPSemantics`, so `SelectionDAGBuilder`
rejected it with "not implemented format" and the verifier-clean IR
failed to compile. Add the mapping and the corresponding entries in the
`expandCONVERT_{TO,FROM}_ARBITRARY_FP` format allowlists.

Unlike every other format the expansions handle so far, Float8E5M3FNU is
unsigned: it has no sign bit, so all 8 bits go to a 5-bit exponent and a
3-bit significand.

Since an unsigned format cannot represent a negative value, a negative
input now saturates to zero when the saturate flag is set, and is poison
otherwise. -0.0 is excluded from that and still converts to +0, and the
check is ordered before the NaN case so a negative NaN still produces
the NaN encoding. APFloat treats constructing a negative value in an

    [4 lines not shown]
DeltaFile
+263-0llvm/test/CodeGen/AMDGPU/float-to-arbitrary-fp-e5m3fnu.ll
+189-0llvm/test/CodeGen/X86/float-to-arbitrary-fp.ll
+34-11llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+7-2llvm/docs/LangRef.md
+2-2llvm/lib/Support/APFloat.cpp
+2-1llvm/unittests/ADT/APFloatTest.cpp
+497-166 files

LLVM/project 74e56f4llvm/lib/Analysis IVDescriptors.cpp

Fixups
DeltaFile
+8-12llvm/lib/Analysis/IVDescriptors.cpp
+8-121 files

LLVM/project f53b4d1llvm/lib/Target/AArch64 AArch64Subtarget.h AArch64ISelLowering.cpp, llvm/test/CodeGen/AArch64 fpimm-legal-expand-optsize.ll fpimm-legal-expand-fuse-literals.ll

[AArch64] Restrict FP imm ISel by accurate subtarget macro-fusion (#214849)

This patch improves the accuracy of FP immediate lowering for runtime
performance builds. Until now we relaxed the instruction count limit
from 2 to 4 merely based on the satisfaction of `ST.hasFuseLiterals`,
but this could be wrong for example false-positive for `MOVN`
instructions which would relax the limit but are not macro fused. Here
we check exactly if immediate materialization parts can be macro fused
using a new subtarget helper which is shared with macro-fusion.

It adds exhaustive test cases for all code sequences that
`isFPImmLegal()` can enable using `expandMOVImm()`. Including f32 as
regression tests - those cannot trigger a subtarget feature check,
because a f32 immed can always be materialized by up to 2 instructions
which is the default limit. As well as an optsize test with
representative test cases.

---------

Co-authored-by: Jon Roelofs <jroelofs at gmail.com>
DeltaFile
+589-0llvm/test/CodeGen/AArch64/fpimm-legal-expand-fuse-literals.ll
+117-0llvm/test/CodeGen/AArch64/fpimm-legal-expand-optsize.ll
+47-0llvm/lib/Target/AArch64/AArch64Subtarget.cpp
+1-28llvm/lib/Target/AArch64/AArch64MacroFusion.cpp
+21-3llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+11-0llvm/lib/Target/AArch64/AArch64Subtarget.h
+786-316 files

LLVM/project 52af9daoffload/languages/include/kernel LanguageRuntime.h, offload/languages/kernel/src LanguageRuntime.cpp

add Memset
DeltaFile
+87-0offload/test/offloading/CUDA/memset.cu
+85-0offload/test/offloading/HIP/memset.hip
+19-0offload/languages/kernel/src/LanguageRuntime.cpp
+1-2offload/test/offloading/HIP/basic_launch_blocks_and_threads.hip
+1-2offload/test/offloading/CUDA/basic_launch_blocks_and_threads.cu
+2-0offload/languages/include/kernel/LanguageRuntime.h
+195-42 files not shown
+197-48 files

LLVM/project 53356c9llvm/lib/Target/RISCV RISCVInstrInfoXqci.td

[RISCV] Use PatLeaf to reduce Xqcibi select and SFB patterns. NFC (#216451)

Assisted-by: Claude
DeltaFile
+34-26llvm/lib/Target/RISCV/RISCVInstrInfoXqci.td
+34-261 files

LLVM/project 924c2c5offload/languages/kernel/src LanguageRuntime.cpp, offload/test/offloading/CUDA devicesync_streams.cu

add proper deviceSync
DeltaFile
+98-0offload/test/offloading/CUDA/devicesync_streams.cu
+97-0offload/test/offloading/HIP/devicesync_streams.hip
+13-6offload/languages/kernel/src/LanguageRuntime.cpp
+1-1offload/test/offloading/HIP/launch_tu.hip
+1-1offload/test/offloading/HIP/basic_launch_multi_arg.hip
+1-1offload/test/offloading/HIP/basic_launch_blocks_and_threads.hip
+211-97 files not shown
+218-1213 files

LLVM/project eddfe45llvm/lib/Target/AArch64 AArch64InstrInfo.cpp, llvm/test/CodeGen/AArch64 early-ifcvt-same-value.mir

AArch64: Fix csel-fold crash on an undef register (#216720)
DeltaFile
+40-0llvm/test/CodeGen/AArch64/early-ifcvt-same-value.mir
+3-1llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
+43-12 files

LLVM/project c130f0allvm/lib/Target/AMDGPU SIInstrInfo.td, llvm/lib/Target/AMDGPU/Disassembler AMDGPUDisassembler.cpp

[AMDGPU][MC] Fix a crash when invalid SDWA encoding is used (#215140)

Fixes #215006.
DeltaFile
+16-0llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
+14-0llvm/test/MC/Disassembler/AMDGPU/gfx9_dasm_err.txt
+4-1llvm/lib/Target/AMDGPU/SIInstrInfo.td
+34-13 files

LLVM/project 448cff5clang/lib/Sema SemaLifetimeSafety.h, clang/test/Sema/LifetimeSafety annotation-suggestions.cpp

macro-suggest
DeltaFile
+15-0clang/test/Sema/LifetimeSafety/annotation-suggestions.cpp
+8-2clang/lib/Sema/SemaLifetimeSafety.h
+23-22 files

LLVM/project 9a1c6e5clang/lib/CIR/Lowering LoweringHelpers.cpp, clang/lib/CIR/Lowering/DirectToLLVM LowerToLLVM.cpp

[CIR] Fix array consts who change during layout (#216732)

The element types of an array can change for the purposes of lowering
depending on the contents of the initializer, particularly with unions.
This patch correctly mutates the array type such that it is either a
contiguous array (the correct way), or a struct that has the same
layout.
DeltaFile
+84-0clang/test/CIR/CodeGen/union-init-padding-array.c
+52-1clang/lib/CIR/Lowering/LoweringHelpers.cpp
+5-6clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
+141-73 files

LLVM/project 74bb5a3llvm/lib/Transforms/Vectorize VPlanTransforms.h, llvm/test/Transforms/LoopVectorize vplan-print-before-after.ll

[VPlan][UTC] Number VPlan passes' instances in printing/filtering (#211424)

Allows to use UTC-generated CHECKs in more tests. First instance of a
given VPlan pass on a function doesn't have a number (would need
`-vplan-print-after=passName$`). Subsequent instances are numbered and
can be filtered as `-vplan-print-after=passName at 2`.
DeltaFile
+174-182llvm/test/Transforms/LoopVectorize/VPlan/AArch64/vplan-printing.ll
+67-62llvm/test/Transforms/LoopVectorize/VPlan/PowerPC/vplan-force-tail-with-evl.ll
+59-14llvm/test/Transforms/LoopVectorize/VPlan/constant-fold.ll
+21-6llvm/lib/Transforms/Vectorize/VPlanTransforms.h
+14-9llvm/test/Transforms/LoopVectorize/VPlan/vplan-print-before-after-all.ll
+6-0llvm/test/Transforms/LoopVectorize/vplan-print-before-after.ll
+341-2736 files

LLVM/project c86596fllvm/lib/Target/AMDGPU AMDGPUCombinerHelper.cpp

AMDGPU: Use mi_match in isFPExtFromF16OrConst (#216807)

Replace the getVRegDef + G_FPEXT/G_FCONSTANT opcode checks with m_GFPExt
and m_GFCst matchers. NFC.

Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
DeltaFile
+5-6llvm/lib/Target/AMDGPU/AMDGPUCombinerHelper.cpp
+5-61 files

LLVM/project aa7316dllvm/test/Transforms/PGOProfile memprof_internal_linkage.ll, llvm/test/Transforms/PGOProfile/Inputs memprof_internal_linkage.memprofraw memprof_internal_linkage.exe

[NFC][MemProf] Replace MemProf binary with YAML (#216796)

Use `split-file` to inline the YAML into the test. Depends on
https://github.com/llvm/llvm-project/pull/216778.
DeltaFile
+24-10llvm/test/Transforms/PGOProfile/memprof_internal_linkage.ll
+0-18llvm/test/Transforms/PGOProfile/Inputs/update_memprof_inputs.sh
+0-0llvm/test/Transforms/PGOProfile/Inputs/memprof_internal_linkage.memprofraw
+0-0llvm/test/Transforms/PGOProfile/Inputs/memprof_internal_linkage.exe
+24-284 files

LLVM/project 38517d9mlir/include/mlir/Dialect/SCF/TransformOps SCFTransformOps.td, mlir/lib/Dialect/SCF/TransformOps SCFTransformOps.cpp

[mlir][scf] Fully unroll SCF/Affine loops (#215220)

Adds a new transform op that fully unrolls given loops. Also, updates
'loop.unroll' documentation to better reflect its functionality.

A new op is added to avoid overloading and changing the default behavior
of the other existing unroll ops.
On its own, the new op complements the existing two transform ops and
mirrors available SCF/Affine utils.

Assisted-by: Copilot
DeltaFile
+71-2mlir/test/python/integration/dialects/transform.py
+49-0mlir/test/Dialect/SCF/transform-ops.mlir
+33-2mlir/include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.td
+23-0mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp
+21-0mlir/test/Dialect/SCF/transform-ops-invalid.mlir
+18-0mlir/python/mlir/dialects/transform/loop.py
+215-46 files

LLVM/project 80b2ef6llvm/include/llvm/MC MCSectionGOFF.h, llvm/lib/MC MCAsmInfoGOFF.cpp

[SystemZ][z/OS] Refactor switching section for HLASM

Emitting the HLASM instructions for switching section is distributed
between MCAsmInfoGOFF and SystemZHLASMAsmStreamer, with some code
duplication. This change consolidates the implementation in
SystemZHLASMAsmStreamer.
DeltaFile
+163-49llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMAsmStreamer.cpp
+5-157llvm/lib/MC/MCAsmInfoGOFF.cpp
+3-1llvm/include/llvm/MC/MCSectionGOFF.h
+171-2073 files

LLVM/project 298ee5bllvm/lib/Target/AMDGPU AMDGPURewriteAGPRCopyMFMA.cpp, llvm/test/CodeGen/AMDGPU rewrite-vgpr-mfma-to-agpr-spill-joint-dom.ll rewrite-vgpr-mfma-to-agpr-spill-joint-dom-mir.mir

[1/2][AMDGPU] Fixed crash due to virtual register defs not dominating uses (#198472)

Fixes https://github.com/llvm/llvm-project/issues/196671.

Fixes duplicate ROCM-24494, LCOMPILER-2224.

In Rewrite AGPR-Copy-MFMA pass, a spill reload may not have a dominating
spill store. If such a slot is unspilled into a vreg, the elimination
phase crashes because virtual register defs do not dominate all uses.
This patch checks for that dominance property for all reloads and skips
unspilling if such a condition is found.

This patch is adapted from 
https://github.com/llvm/llvm-project/pull/167347

Cherry-picked https://github.com/ROCm/llvm-project/commit/e5d02ddb
Authored by: Austin Kerbow <Austin.Kerbow at amd.com>

Instead of scanning through instructions within the reload basic block,

    [17 lines not shown]
DeltaFile
+1,770-0llvm/test/CodeGen/AMDGPU/rewrite-vgpr-mfma-to-agpr-spill-joint-dom-mir.mir
+159-0llvm/test/CodeGen/AMDGPU/rewrite-vgpr-mfma-to-agpr-spill-joint-dom.ll
+84-4llvm/lib/Target/AMDGPU/AMDGPURewriteAGPRCopyMFMA.cpp
+2,013-43 files

LLVM/project 5519448clang/lib/Sema SemaTemplateInstantiateDecl.cpp, clang/test/CXX/temp/temp.decls/temp.friend p6.cpp

[Clang] Prevent an assertion failure when instantiating an invalid friend function template (#216727)к

Fixes #216694

---

This patch addresses an assertion failure that occurs when instantiating
an invalid friend function template by marking its `FriendDecl` wrapper
as invalid.
DeltaFile
+9-0clang/test/CXX/temp/temp.decls/temp.friend/p6.cpp
+2-1clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+11-12 files

LLVM/project 9927fcfclang/lib/Sema SemaLifetimeSafety.h, clang/test/Sema/LifetimeSafety annotation-suggestions.cpp

macro-suggest
DeltaFile
+15-0clang/test/Sema/LifetimeSafety/annotation-suggestions.cpp
+10-2clang/lib/Sema/SemaLifetimeSafety.h
+25-22 files

LLVM/project c9c9d41clang/include/clang/CIR/Dialect/IR CIRTypes.td, clang/lib/CIR/CodeGen CIRGenRecordLayoutBuilder.cpp

[CIR] Mark bit-field access units as their own member kinds

A bit-field access unit is as wide as the compiler decides, which can be
narrower than the declared type of the bit-fields in it, and the member marks
say nothing about that: a unit with a named occupant is `data` and one with only
unnamed occupants is `empty`, the same marks a declared field gets.  So a member
holding a 32-bit bit-field of `long long` looks exactly like an `unsigned`
field, and the two are not the same to the ABI.  `BitsContainNoUserData`
recurses on the declared type, finds user data past bit 32 in the first and none
in the second, and classic CodeGen coerces the enclosing records to `i64` and
`i32`.

Split the unit cases out as `bitfield` and `empty_bitfield`.  A unit holds data
exactly when a named bit-field lands in it, so `isEmptyForABI` answers the same
for every record once it asks `holdsDataForABI` instead of testing for `data`
alone, and padding is untouched.  Nothing classifies on the new marks yet, so no
ABI treatment changes.  What needs them is pad-aware eightbyte classification,
which cannot tell a record's declared extents from its access units without
them.

    [2 lines not shown]
DeltaFile
+64-0clang/test/CIR/CodeGen/no-unique-address.cpp
+34-12clang/test/CIR/CodeGen/record-member-kinds.c
+27-16clang/lib/CIR/CodeGen/CIRGenRecordLayoutBuilder.cpp
+26-15clang/include/clang/CIR/Dialect/IR/CIRTypes.td
+15-16clang/test/CIR/CodeGen/record-member-kinds.cpp
+26-0clang/unittests/CIR/RecordMemberKindTest.cpp
+192-5913 files not shown
+262-9119 files

LLVM/project b489177llvm/lib/Target/AMDGPU SIFrameLowering.cpp

[AMDGPU] Don't use MCRegister to hold Dwarf register numbers. NFC (#216766)
DeltaFile
+3-3llvm/lib/Target/AMDGPU/SIFrameLowering.cpp
+3-31 files

LLVM/project 4c30f45clang/lib/Sema SemaLifetimeSafety.h, clang/test/Sema/LifetimeSafety annotation-suggestions.cpp

macro-suggest
DeltaFile
+27-8clang/lib/Sema/SemaLifetimeSafety.h
+15-0clang/test/Sema/LifetimeSafety/annotation-suggestions.cpp
+42-82 files

LLVM/project 9018adcclang/include/clang/CIR/Dialect/IR CIRTypes.h, clang/lib/CIR/Dialect/Transforms CallConvLoweringPass.cpp

[CIR] Classify around a record's padding on x86_64

The x86_64 bridge refused any struct whose CIR type carries a pad member, which
is every over-aligned record and every record with a gap between two members.
The ABI library already reads each field's explicit offset, sizes the record
from its own size, and treats a gap no field overlaps as holding no user data.
However, the bridge was handing it every member as a field, padding included, so
a record's padding bytes read as data.  Now we build the field list from the
members that hold data.

Assisted-by: Cursor / claude-opus-5
DeltaFile
+151-0clang/test/CIR/CodeGen/call-conv-lowering-x86_64-padded.c
+84-0clang/test/CIR/Transforms/abi-lowering/x86_64-struct-padded.cir
+55-18clang/test/CIR/Transforms/abi-lowering/x86_64-aggregate-nyi.cir
+41-16clang/lib/CIR/Dialect/Transforms/CallConvLoweringPass.cpp
+7-0clang/include/clang/CIR/Dialect/IR/CIRTypes.h
+338-345 files

LLVM/project a6c300ellvm/lib/Target/AMDGPU AMDGPUInstructionSelector.cpp

AMDGPU: Use mi_match for selector vector-source instruction lookups (#216792)

Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
DeltaFile
+11-8llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
+11-81 files

LLVM/project 1f5296bllvm/lib/CodeGen/SelectionDAG TargetLowering.cpp

Address review comments

Only clamp negative inputs to zero when saturating. Without saturation
the result is poison, so nothing needs to be emitted and no select gets
a poison operand.

Trim the comments added by the previous commit.

Change-Id: I7b86ebd6d0b7853f4dea7312bec21aea2bb91def
DeltaFile
+11-14llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+11-141 files

LLVM/project b3bac42flang/lib/Parser basic-parsers.h Fortran-parsers.cpp, flang/test/Parser recovery09.f90

[flang] Improve error for misplaced statement after CONTAINS in derived type (#215886)

A statement after `CONTAINS` in a derived type that is not a type-bound
procedure binding (e.g. a second `CONTAINS`, an `IMPORT`, or a misplaced
subprogram) leaked the intrinsic type-spec parse failures (`expected
'COMPLEX'`, `expected 'INTEGER'`, ...) instead of reporting that a
type-bound procedure binding was expected. In the misplaced-subprogram
case flang emitted an avalanche of unrelated `expected '<type-keyword>'`
errors.

This is a diagnostic regression from #203379, which added
`DataComponentDefStmt` as a trailing alternative in the
type-bound-proc-binding parser. Its intended `fail<>()` message only
fires when `DataComponentDefStmt` fully matches; for other invalid
statement the partial parse into `declarationTypeSpec` displaced the
recovery message in `CombineFailedParses`.

This patch wraps the binding alternatives in `withMessage()` so that
when none of them match a token a single clear message is emitted:

    [17 lines not shown]
DeltaFile
+36-7flang/test/Parser/recovery09.f90
+9-6flang/lib/Parser/Fortran-parsers.cpp
+8-1flang/lib/Parser/basic-parsers.h
+53-143 files

LLVM/project e38d4c3llvm/lib/Target/RISCV RISCVVLOptimizer.cpp, llvm/test/CodeGen/RISCV/rvv vl-opt-undef-vl.mir

RISCV: Fix VL optimizer crash on an undef VL operand (#216803)

Found by AI while working on something else.

Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
DeltaFile
+18-0llvm/test/CodeGen/RISCV/rvv/vl-opt-undef-vl.mir
+4-1llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
+22-12 files

LLVM/project 1b17c33llvm/lib/Target/SPIRV SPIRVNonSemanticDebugHandler.cpp, llvm/test/CodeGen/SPIRV/debug-info debug-line-loop-control-intel.ll debug-line.ll

Add support for NSDI DebugLine and DebugNoLine. (#215851)

Add support for
[DebugLine](https://github.khronos.org/SPIRV-Registry/nonsemantic/NonSemantic.Shader.DebugInfo.html#DebugLine)
and DebugNoLine.
DeltaFile
+160-0llvm/lib/Target/SPIRV/SPIRVNonSemanticDebugHandler.cpp
+96-0llvm/test/CodeGen/SPIRV/debug-info/debug-line-selection-merge.ll
+83-0llvm/test/CodeGen/SPIRV/debug-info/debug-line-calls.ll
+73-0llvm/test/CodeGen/SPIRV/debug-info/debug-line-if-phi.ll
+68-0llvm/test/CodeGen/SPIRV/debug-info/debug-line.ll
+67-0llvm/test/CodeGen/SPIRV/debug-info/debug-line-loop-control-intel.ll
+547-09 files not shown
+874-115 files

LLVM/project a10f62eclang/include/clang/CIR/Dialect/IR CIRAttrs.td, clang/lib/CIR/CodeGen CIRGenExprCXX.cpp

[CIR] Implement aligned-array-delete. (#216789)

This ends up being a pretty trivial implementation, since we just have
to add the additional i64 argument to the call. This patch adds that,
after threading the alignment through CIR.

Also, the type-aware and destroying deletes aren't valid on a array
delete, so replace those checks with 'assert' instead.
DeltaFile
+140-0clang/test/CIR/CodeGen/delete-array-aligned.cpp
+10-4clang/lib/CIR/Dialect/Transforms/CXXABILowering.cpp
+9-1clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp
+1-1clang/include/clang/CIR/Dialect/IR/CIRAttrs.td
+160-64 files

LLVM/project d7594bfclang/test/OpenMP reverse_codegen.cpp interchange_codegen.cpp

[Clang][CodeGen] Use ptrtoaddr for pointer diff (#210729)

We don't have to expose the provenance of pointers for pointer
subtraction, so use ptrtoaddr instead of ptrtoint if -fwrapv-pointer is
not set.
DeltaFile
+1,049-1,049clang/test/OpenMP/parallel_for_codegen.cpp
+124-118clang/test/OpenMP/tile_codegen.cpp
+124-118clang/test/OpenMP/stripe_codegen.cpp
+82-78clang/test/OpenMP/fuse_codegen.cpp
+58-57clang/test/OpenMP/interchange_codegen.cpp
+36-36clang/test/OpenMP/reverse_codegen.cpp
+1,473-1,45611 files not shown
+1,569-1,52017 files

LLVM/project aa2c1b5llvm/include/llvm/CodeGen LiveIntervals.h, llvm/lib/CodeGen MachineBasicBlock.cpp LiveIntervals.cpp

[CodeGen] Fix stale LiveIntervals regmask tables after MachineBasicBl… (#209610)

MachineBasicBlock::splitAt() moves the tail of a block -- including any
call instructions carrying register-mask operands -- into a newly
created block. When LiveIntervals is attached it calls
LIS->insertMBBInMaps() for the new block, which records the block with
zero regmask slots. That is only correct for a fresh, empty block:
because the tail (and its regmasks) was *moved* out of the original
block, the per-block RegMaskBlocks index for both blocks is left stale,
so checkRegMaskInterference() can miss a call clobber and the register
allocator can assign a live value to a clobbered physical register.

Add a LiveIntervals::splitAt(Orig, SplitBB) entry point that inserts
SplitBB into the SlotIndexes/regmask maps and then re-slices the moved
regmask slots out of Orig's RegMaskBlocks entry into SplitBB's
(RegMaskSlots is sorted, so the slots that moved are those at/after
SplitBB's start index). MachineBasicBlock::splitAt() now calls it in
place of insertMBBInMaps().


    [13 lines not shown]
DeltaFile
+39-0llvm/lib/CodeGen/LiveIntervals.cpp
+33-0llvm/unittests/MI/LiveIntervalTest.cpp
+19-4llvm/include/llvm/CodeGen/LiveIntervals.h
+1-1llvm/lib/CodeGen/MachineBasicBlock.cpp
+92-54 files