LLVM/project d3b54ce — clang/lib/Analysis/LifetimeSafety LoanPropagation.cpp

[LifetimeSafety][NFC] Do not store empty loan sets (#246460)

An origin missing from the loan propagation lattice has no loans, so
remove it instead of storing an empty set when it is killed, expires or
receives no loans from a flow. This keeps the maps smaller.

On the lifetime safety benchmarks this reduces the peak memory by 8% for
the CFG merge test and 3% for the switch fan-out test, with no change in
instructions for the others.

Assisted-by: Claude Opus 5.5

---------

Co-authored-by: Gabor Horvath <gaborh at apple.com>
DeltaFile
+6-5clang/lib/Analysis/LifetimeSafety/LoanPropagation.cpp
+6-51 files

LLVM/project bf7d264 — llvm/lib/Transforms/Utils BuildLibCalls.cpp, llvm/test/Transforms/InferFunctionAttrs annotate.ll

[BuildLibCalls] Do not mark ctermid argument as nocapture (#241813)

Remove setDoesNotCapture flag from ctermid.

char* ctermid(char* s), according to POSIX spec returns either address
of static buffer, or its argument if non-NULL, which counts as capture.

This was detected with RTEMS tests, clang incorrectly optimized out
input to ctermid assuming nocapture.
DeltaFile
+3-0llvm/lib/Transforms/Utils/BuildLibCalls.cpp
+1-1llvm/test/Transforms/InferFunctionAttrs/annotate.ll
+4-12 files

LLVM/project 022b71c — llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes LoadStoreVec.h, llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes LoadStoreVec.cpp

[SandboxVec][LoadStoreVec] Factor out canUnpack and unpackIfNeeded (NFC) (#245732)

This moves the logic that unpacks each original load from the lanes it
occupies in a vector load, and the check that those lanes can be
reinterpreted as the load's type, out of `vectorizeLoads()` into two new
helpers, `canUnpack()` and `unpackIfNeeded()`.

Co-authored-by: Cursor <cursoragent at cursor.com>
DeltaFile
+34-25llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/LoadStoreVec.cpp
+10-0llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/LoadStoreVec.h
+44-252 files

LLVM/project 2dd9157 — clang/include/clang/Analysis RetainSummaryManager.h, clang/lib/Analysis RetainSummaryManager.cpp

[analyzer][NFC] Skip RetainSummaryManager's OSObject and ISL checks when they cannot match (#246458)

For every call it summarizes, RetainSummaryManager runs AST matchers to
check whether a record derives from OSMetaClassBase, and prints
parameter types to check for an "isl_" prefix. Neither can match if no
identifier in the translation unit is named OSMetaClassBase or starts
with "isl_", which is the case for most translation units, so skip them
then.

On some LLVM TUs (GVN, LiveVariables, RegionStore, SemaExpr) this
reduces the instructions of the static analyzer by 1.5-2.4%.

Assisted-by: Claude Opus 5.5

---------

Co-authored-by: Gabor Horvath <gaborh at apple.com>
DeltaFile
+24-1clang/include/clang/Analysis/RetainSummaryManager.h
+12-7clang/lib/Analysis/RetainSummaryManager.cpp
+36-82 files

LLVM/project a9bca96 — clang/lib/CIR/CodeGen CIRGenStmtOpenMP.cpp

[CIR] Fix -Wunused-variable in 8927ff7 (#246473)

Mark the variable [[maybe_unused]] given it is used multiple times in an
assertion.
DeltaFile
+2-1clang/lib/CIR/CodeGen/CIRGenStmtOpenMP.cpp
+2-11 files

LLVM/project a3d0221 — llvm/lib/Target/X86 X86ISelLowering.cpp, llvm/test/CodeGen/X86 half.ll vector-shuffle-combining-avx2.ll

[X86] matchBinaryShuffle - don't fold BLEND(X,Y) --> OR(X,Y) if any demanded elts may contain poison/undef (#246461)

Similar to #245048, KnownBits analysis doesn't guarantee that a value
isn't UNDEF/POISON, so after MaskedVectorIsZero we need to confirm with
isGuaranteedNotToBeUndefOrPoison

Fixes #246348
DeltaFile
+5-2llvm/lib/Target/X86/X86ISelLowering.cpp
+3-3llvm/test/CodeGen/X86/vector-shuffle-combining-avx2.ll
+2-2llvm/test/CodeGen/X86/half.ll
+10-73 files

LLVM/project fcb6a53 — llvm/include/llvm/ProfileData/Coverage CoverageMapping.h, llvm/lib/ProfileData/Coverage CoverageMappingReader.cpp CoverageMapping.cpp

[llvm-cov] Look up expansion regions by FileID with binary search

Region vectors are already sorted by FileID, so filtering for one file
is just selecting a contiguous subrange. Do that with a binary search
instead of scanning the whole function.
DeltaFile
+31-10llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
+8-0llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
+4-2llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
+43-123 files

LLVM/project cec386f — llvm/lib/Target/AMDGPU SIInsertWaitcnts.cpp, llvm/test/CodeGen/AMDGPU waitcnt-vavdst-loop-header.mir

[AMDGPU] Defer S_WAITCNT_DEPCTR erasure and updates in expert mode

A pre-existing S_WAITCNT_DEPCTR was erased, or had its VA_VDST and
VM_VSRC fields relaxed, as soon as the incoming state made those waits
look redundant. In a loop header that happens on the first visit, before
the backedge adds the instructions of the loop body. The wait is then
lost when the header is visited again with them pending.

Keep the original operand of every S_WAITCNT_DEPCTR, including
duplicates, while iterating to the fixed point, and only apply the final
encoding or erase the instruction at the end of the pass.

Also reset the VA_VDST field of a duplicate S_WAITCNT_DEPCTR to "no
wait" once its wait has been folded into the first one, instead of
leaving a redundant copy of the combined wait behind.

Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+34-36llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
+6-4llvm/test/CodeGen/AMDGPU/waitcnt-vavdst-loop-header.mir
+40-402 files

LLVM/project 8a2fe05 — llvm/lib/Target/AMDGPU SIInsertWaitcnts.cpp

[AMDGPU] Reuse waitcnt operand update helper
DeltaFile
+15-19llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
+15-191 files

LLVM/project 0826adf — llvm/test/CodeGen/AMDGPU waitcnt-vavdst-loop-header.mir

[AMDGPU] Pre-commit test for S_WAITCNT_DEPCTR in loop headers (NFC) (#246305)

Add baseline coverage for loop-header S_WAITCNT_DEPCTR handling in
expert scheduling mode. This test will make the effects of the fix in
https://github.com/llvm/llvm-project/pull/246081 visible.

Tested with the existing pass on gfx12 and gfx1250.

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+205-0llvm/test/CodeGen/AMDGPU/waitcnt-vavdst-loop-header.mir
+205-01 files

LLVM/project ecc519f — llvm/test/CodeGen/PowerPC sext_elimination.mir fold-rlwinm.mir

[PowerPC][test] Fix mismatched copy-like operand sizes in MIR fixtures (#238350)

Fixing some register size mismatches on COPY instructions.

Came up with: https://github.com/llvm/llvm-project/pull/234959
DeltaFile
+2-2llvm/test/CodeGen/PowerPC/sext_elimination.mir
+2-2llvm/test/CodeGen/PowerPC/fold-rlwinm.mir
+4-42 files

LLVM/project 600fc5a — offload/include/Shared Debug.h

[offload][debug] Add REPORT_WARN and REPORT_FATAL macros

Add two new macros in the same style as REPORT(). REPORT_WARN prints a warning,
while REPORT_FATAL prints a fatal error and aborts the program.

Assisted-by: Claude Sonnet 5.5
DeltaFile
+42-8offload/include/Shared/Debug.h
+42-81 files

LLVM/project a645891 — llvm/test/Transforms/LoopIdiom cyclic-redundancy-check-memoryssa.ll cyclic-redundancy-check.ll, llvm/test/Transforms/LoopIdiom/AArch64 find-first-byte.ll cyclic-redundancy-check.ll

[LoopIdiom] Enable IRBuilder GEP canonicalization (#246421)
DeltaFile
+20-20llvm/test/Transforms/LoopIdiom/RISCV/cyclic-redundancy-check.ll
+12-12llvm/test/Transforms/LoopIdiom/cyclic-redundancy-check.ll
+7-7llvm/test/Transforms/LoopIdiom/X86/cyclic-redundancy-check.ll
+7-7llvm/test/Transforms/LoopIdiom/AArch64/cyclic-redundancy-check.ll
+3-3llvm/test/Transforms/LoopIdiom/AArch64/find-first-byte.ll
+1-1llvm/test/Transforms/LoopIdiom/cyclic-redundancy-check-memoryssa.ll
+50-503 files not shown
+51-539 files

LLVM/project 17292a5 — llvm/test/CodeGen/PowerPC vec_conv_fp64_to_i16_elts.ll vec_conv_fp64_to_i8_elts.ll

[PowerPC] Enable SlotIndexes compaction by default

Greedy measures live ranges in slot indexes, and instructions erased
before allocation (by PHI elimination, two-address lowering and the
coalescer) leave entries behind that make ranges look longer than
they are. Opt PowerPC in to dropping them, as AMDGPU and ARM do, so
allocation works with real distances. Passing
-greedy-compact-slot-indexes=false restores the old behaviour.

On CTMark (pwr8, pwr10, AIX, ppc32), .text and llc compile time move
by less than 0.03% and evictions drop by 1.5-5.8%.

The test updates are register allocation changes; csr-split.ll gets
back the live range split it was written to check.
DeltaFile
+1,589-1,644llvm/test/CodeGen/PowerPC/clmul-vector.ll
+279-279llvm/test/CodeGen/PowerPC/all-atomics.ll
+192-192llvm/test/CodeGen/PowerPC/vec_conv_fp32_to_i16_elts.ll
+165-165llvm/test/CodeGen/PowerPC/more-dq-form-prepare.ll
+142-142llvm/test/CodeGen/PowerPC/vec_conv_fp64_to_i8_elts.ll
+132-132llvm/test/CodeGen/PowerPC/vec_conv_fp64_to_i16_elts.ll
+2,499-2,55437 files not shown
+3,490-3,54243 files

LLVM/project 1d93772 — llvm/lib/Target/RISCV RISCVFrameLowering.cpp, llvm/test/CodeGen/RISCV/rvv rvv-framelayout.ll calling-conv-fastcc.ll

[RISCV] Fix misaligned RVV stack objects

RVV stack objects were laid out from the top of the RVV area and then
shifted down by the area's alignment padding, so only the lowest
object was guaranteed its alignment. An over-aligned object above it
could end up at a misaligned address.

Lay the objects out from the end of the area that the base register
points at, most aligned first, and put the padding at the other end.
Each object is then at a multiple of its alignment from an aligned
base for any VLEN.

Fixes #246451
DeltaFile
+735-845llvm/test/CodeGen/RISCV/rvv/vector-interleave.ll
+287-116llvm/test/CodeGen/RISCV/rvv/allocate-lmul-2-4-8.ll
+82-42llvm/test/CodeGen/RISCV/rvv/rvv-stack-align.mir
+81-37llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
+32-28llvm/test/CodeGen/RISCV/rvv/calling-conv-fastcc.ll
+14-12llvm/test/CodeGen/RISCV/rvv/rvv-framelayout.ll
+1,231-1,0806 files

LLVM/project 815d6cc — llvm/test/CodeGen/RISCV/rvv rvv-framelayout.ll

[RISCV] Precommit RVV stack alignment test (NFC)

Show the current frame layout when a more aligned scalable-vector
stack object has a lower frame index than a less aligned one. The
more aligned object is placed at an address that is not a multiple
of its alignment.

Precommit for #246451
DeltaFile
+34-0llvm/test/CodeGen/RISCV/rvv/rvv-framelayout.ll
+34-01 files

LLVM/project 5a86c51 — clang/test/Sema/AArch64 arm_sve_feature_dependent_sve_AND_LP_sve2p3_OR_sme2p3_RP_AND_fpv2___sme_AND_LP_sve2p3_OR_sme2p3_RP_AND_fpv2.c, llvm/test/CodeGen/AArch64 fpv2-sve2p3-intrinsics-fmaxmginm.ll fpv2-sve2p3-intrinsics-fmaxmg.ll

[AArch64] Implement ACLE intrinsics for FPv2 SVE min/max instructions

ACLE PR: https://github.com/ARM-software/acle/pull/480

Implements the following intrinsics:

- svmaxmg / svminmg
- svmaxinm / svmininm
- svmaxmginm / svminmginm

Includes f16, f32, and f64 types, _m, _z, and _x predication and _n variants

AI assistance: Codex used for generating test cases
DeltaFile
+691-0clang/test/Sema/AArch64/arm_sve_feature_dependent_sve_AND_LP_sve2p3_OR_sme2p3_RP_AND_fpv2___sme_AND_LP_sve2p3_OR_sme2p3_RP_AND_fpv2.c
+382-0llvm/test/CodeGen/AArch64/fpv2-sve2p3-intrinsics-fmaxmginm.ll
+382-0llvm/test/CodeGen/AArch64/fpv2-sve2p3-intrinsics-fmaxmg.ll
+382-0llvm/test/CodeGen/AArch64/fpv2-sve2p3-intrinsics-fminmginm.ll
+382-0llvm/test/CodeGen/AArch64/fpv2-sve2p3-intrinsics-fminmg.ll
+382-0llvm/test/CodeGen/AArch64/fpv2-sve2p3-intrinsics-fmininm.ll
+2,601-012 files not shown
+5,603-718 files

LLVM/project 7b99221 — llvm/lib/Target/AMDGPU SIInsertWaitcnts.cpp, llvm/test/CodeGen/AMDGPU waitcnt-vavdst-loop-header.mir

[AMDGPU] Defer S_WAITCNT_DEPCTR erasure and updates in expert mode

A pre-existing S_WAITCNT_DEPCTR was erased, or had its VA_VDST and
VM_VSRC fields relaxed, as soon as the incoming state made those waits
look redundant. In a loop header that happens on the first visit, before
the backedge adds the instructions of the loop body. The wait is then
lost when the header is visited again with them pending.

Keep the original operand of every S_WAITCNT_DEPCTR, including
duplicates, while iterating to the fixed point, and only apply the final
encoding or erase the instruction at the end of the pass.

Also reset the VA_VDST field of a duplicate S_WAITCNT_DEPCTR to "no
wait" once its wait has been folded into the first one, instead of
leaving a redundant copy of the combined wait behind.

Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+34-36llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
+6-4llvm/test/CodeGen/AMDGPU/waitcnt-vavdst-loop-header.mir
+40-402 files

LLVM/project 611b5ee — llvm/lib/Target/AMDGPU SIInsertWaitcnts.cpp

[AMDGPU] Reuse waitcnt operand update helper
DeltaFile
+15-19llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
+15-191 files

LLVM/project 301d4f8 — llvm/test/CodeGen/AMDGPU waitcnt-vavdst-loop-header.mir

[AMDGPU] Precommit test for S_WAITCNT_DEPCTR in loop headers (NFC)

Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+205-0llvm/test/CodeGen/AMDGPU/waitcnt-vavdst-loop-header.mir
+205-01 files

LLVM/project a58c4ab — llvm/test/CodeGen/AMDGPU i1-uniform-loop-carried.ll

[AMDGPU] Fix failing test after #231101 (#246444)

Regenerate checks after #239090 which landed first.
DeltaFile
+16-20llvm/test/CodeGen/AMDGPU/i1-uniform-loop-carried.ll
+16-201 files

LLVM/project b648c06 — llvm/lib/Transforms/InstCombine InstCombineSelect.cpp, llvm/test/Transforms/InstCombine select-fixed-zero.ll

[InstCombine] Drop poison-generating annotations from call in select-of-zero fold (#245874)

Fixes #245656.

`foldSelectZeroOrFixedOp` folds `select (x == 0), 0, op(x, y)` into
`op(x, freeze(y))`, which evaluates `op` unconditionally. If `op` is a
call (`umin`, `fshl`, `fshr`) with a `range` attribute that excludes
`0`, e.g. `range(i64 1, 0)` on the return value or an argument, the call
now returns a value outside its declared range at `x == 0`. The result
is poison where the original select produced `0`.

Drop the poison-generating annotations on call instructions. Non-call
ops (`mul`, `idiv`, etc.) keep their `nuw`/`nsw`/`exact` flags, since at
`x == 0`, `0 * y` cannot overflow and `0 sdiv/udiv y` stays exact.

Alive2 proofs:
- Return range dropped: https://alive2.llvm.org/ce/z/ZhgWuj
- Arg 0 range dropped: https://alive2.llvm.org/ce/z/dAKtZF
- Arg 1 range dropped: https://alive2.llvm.org/ce/z/D5URrH

    [2 lines not shown]
DeltaFile
+90-0llvm/test/Transforms/InstCombine/select-fixed-zero.ll
+4-0llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+94-02 files

LLVM/project ce7e136 — mlir/test/Dialect/Vector canonicalize.mlir

Address review comment
DeltaFile
+19-0mlir/test/Dialect/Vector/canonicalize.mlir
+19-01 files

LLVM/project 669294c — llvm/lib/Target/Mips Mips.h MipsInstrInfo.cpp, llvm/test/CodeGen/Mips mips1-mflo-hilo-hazard.mir mips1-hilo-hazard.ll

[Mips] Fix the HI/LO hazard check on MIPS I to MIPS IV (#245689)

MIPS I to MIPS IV need two instructions between an mflo or mfhi and the
next instruction that writes HI or LO. handleMFLO() only knew about
mult, div and divu, so multu, dmultu, mthi and mtlo were missed, and
mflo followed by multu, as in a 64-bit multiply on O32, got no nops. It
also did not look at the instruction in a delay slot, so a div that the
delay slot filler placed in the delay slot of a branch right after an
mflo was missed as well.

Check the registers an instruction writes instead of a list of opcodes,
and look at the next two instructions that can execute after each mflo
or mfhi, including the instruction in a delay slot and the first
instructions of every successor block. Add the nops right before the
instruction that writes HI or LO when it is in the same block, or else
right after the mflo, or at the start of the successors when the mflo is
in a delay slot.

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+199-0llvm/test/CodeGen/Mips/mips1-hilo-hazard.ll
+165-0llvm/test/CodeGen/Mips/mips1-mflo-hilo-hazard.mir
+77-55llvm/lib/Target/Mips/MipsBranchExpansion.cpp
+10-2llvm/lib/Target/Mips/MipsInstrInfo.cpp
+0-7llvm/lib/Target/Mips/Mips.h
+451-645 files

LLVM/project e539f81 — llvm/test/CodeGen/SystemZ zos-ada.ll zos-ret-addr.ll

Add some examples
DeltaFile
+21-13llvm/test/CodeGen/SystemZ/zos-frameaddr.ll
+15-9llvm/test/CodeGen/SystemZ/zos-ret-addr.ll
+8-5llvm/test/CodeGen/SystemZ/zos-ada.ll
+44-273 files

LLVM/project ea5eb77 — llvm/include/llvm/Analysis MemoryBuiltins.h, llvm/include/llvm/Transforms/IPO Attributor.h

[MemoryBuiltins] Remove more TLI support (#246418)

Remove TLI argument from getAllocAlignment() and
getInitialValueOfAllocation() and rely exclusively on
`allocalign`/`allockind` instead.
DeltaFile
+6-21llvm/lib/Analysis/MemoryBuiltins.cpp
+7-7llvm/lib/Transforms/IPO/Attributor.cpp
+5-8llvm/include/llvm/Analysis/MemoryBuiltins.h
+4-5llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+5-4llvm/include/llvm/Transforms/IPO/Attributor.h
+2-3llvm/lib/Transforms/Scalar/NewGVN.cpp
+29-484 files not shown
+33-5310 files

LLVM/project 332ab85 — llvm/test/CodeGen/X86 vector-shuffle-combining-avx2.ll

[X86] Add test coverage for #246348 (#246429)
DeltaFile
+29-0llvm/test/CodeGen/X86/vector-shuffle-combining-avx2.ll
+29-01 files

LLVM/project 57f7ce9 — clang/test/Sema/AArch64 arm_sve_feature_dependent_sve_AND_LP_sve2p3_OR_sme2p3_RP_AND_fpv2___sme_AND_LP_sve2p3_OR_sme2p3_RP_AND_fpv2.c, llvm/test/CodeGen/AArch64 fpv2-sve2p3-intrinsics-fmininm.ll fpv2-sve2p3-intrinsics-fmaxmginm.ll

[AArch64] Implement ACLE intrinsics for FPv2 SVE min/max instructions

ACLE PR: https://github.com/ARM-software/acle/pull/480

Implements the following intrinsics:

- svmaxmg / svminmg
- svmaxinm / svmininm
- svmaxmginm / svminmginm

Includes f16, f32, and f64 types, _m, _z, and _x predication and _n variants

AI assistance: Codex used for generating test cases
DeltaFile
+691-0clang/test/Sema/AArch64/arm_sve_feature_dependent_sve_AND_LP_sve2p3_OR_sme2p3_RP_AND_fpv2___sme_AND_LP_sve2p3_OR_sme2p3_RP_AND_fpv2.c
+382-0llvm/test/CodeGen/AArch64/fpv2-sve2p3-intrinsics-fmininm.ll
+382-0llvm/test/CodeGen/AArch64/fpv2-sve2p3-intrinsics-fmaxmginm.ll
+382-0llvm/test/CodeGen/AArch64/fpv2-sve2p3-intrinsics-fmaxmg.ll
+382-0llvm/test/CodeGen/AArch64/fpv2-sve2p3-intrinsics-fminmginm.ll
+382-0llvm/test/CodeGen/AArch64/fpv2-sve2p3-intrinsics-fminmg.ll
+2,601-012 files not shown
+5,611-1018 files

LLVM/project 1b5bd3c — llvm/lib/Target/AMDGPU SIInsertWaitcnts.cpp, llvm/test/CodeGen/AMDGPU waitcnt-vavdst-loop-header.mir

[AMDGPU] Defer S_WAITCNT_DEPCTR erasure and updates in expert mode

A pre-existing S_WAITCNT_DEPCTR was erased, or had its VA_VDST and
VM_VSRC fields relaxed, as soon as the incoming state made those waits
look redundant. In a loop header that happens on the first visit, before
the backedge adds the instructions of the loop body. The wait is then
lost when the header is visited again with them pending.

Keep the original operand of every S_WAITCNT_DEPCTR, including
duplicates, while iterating to the fixed point, and only apply the final
encoding or erase the instruction at the end of the pass.

Also reset the VA_VDST field of a duplicate S_WAITCNT_DEPCTR to "no
wait" once its wait has been folded into the first one, instead of
leaving a redundant copy of the combined wait behind.

Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+34-36llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
+6-4llvm/test/CodeGen/AMDGPU/waitcnt-vavdst-loop-header.mir
+40-402 files

LLVM/project 271d2a8 — llvm/lib/Target/AMDGPU SIInsertWaitcnts.cpp

[AMDGPU] Reuse waitcnt operand update helper
DeltaFile
+15-19llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
+15-191 files