LLVM/project c348d3b — llvm/lib/Transforms/Vectorize/SLPVectorizer SLPUtils.cpp, llvm/test/Transforms/SLPVectorizer/X86 abs-sub-non-overflowing-lane.ll

[SLP] Fix crash in isCommutative for abs users of non-overflowing lanes

An or, xor or and lane converted to sub keeps its original opcode and has
no wrap flags, so querying nsw on it asserts. Such a lane does not clear
nsw of the vector sub either, so it is treated like a copyable lane: its
operands can be swapped only if abs is poison on INT_MIN.

Fixes #242907.

Pull-request: https://github.com/llvm/llvm-project/pull/242927
DeltaFile
+52-0llvm/test/Transforms/SLPVectorizer/X86/abs-sub-non-overflowing-lane.ll
+3-1llvm/lib/Transforms/Vectorize/SLPVectorizer/SLPUtils.cpp
+55-12 files

LLVM/project 4ae5ba3 — llvm/include/llvm/IR DataLayout.h, llvm/lib/IR DataLayout.cpp

IR: Handle integers and pointers first in DataLayout::getTypeAllocSize

getTypeAllocSize is mostly called on integer and pointer types, but the
recursive array and struct cases made every call set up a large stack
frame. Move the other types to a separate function, so the common cases
don't need it. The pointer case also only looks up the pointer spec once.

callgrind instructions, opt -O3: sqlite3 -0.16%, consumer-typeset z08.bc
-0.13%, kimwitu++ k.bc -0.10%, SPASS cnf.bc -0.09%. CTMark
instructions:u: O3 -0.06%, ThinLTO -0.08%.

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+19-11llvm/lib/IR/DataLayout.cpp
+3-0llvm/include/llvm/IR/DataLayout.h
+22-112 files

LLVM/project f2d135f — llvm/include/llvm/IR Type.h, llvm/lib/IR Type.cpp

IR: Make Type::getScalarSizeInBits inline for integers

getScalarSizeInBits is called very often from ValueTracking and
InstCombine, almost always on integer types. Return the integer width
directly instead of calling getPrimitiveSizeInBits out of line.

callgrind instructions, opt -O3: sqlite3 -0.18%, consumer-typeset z08.bc
-0.11%, SPASS cnf.bc -0.10%. CTMark instructions:u: O3 -0.06%,
ThinLTO -0.06%.

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+8-1llvm/include/llvm/IR/Type.h
+0-5llvm/lib/IR/Type.cpp
+8-62 files

LLVM/project a6f99eb — llvm/lib/Target/NVPTX NVPTXISelLowering.cpp, llvm/test/CodeGen/NVPTX math-intrins.ll

[NVPTX] Expand lrint and llrint for f32 and f64 (#242764)

marks `(l)lrint` as Expand for f32/f64 on NVPTX. 

they defaulted to LibCall, since NVPTX has no libm, they crashed. 

now they use the generic FRINT + FP_TO_SINT expansion.

from #240078
DeltaFile
+99-0llvm/test/CodeGen/NVPTX/math-intrins.ll
+2-0llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
+101-02 files

LLVM/project 3324d40 — clang/include/clang/Basic BuiltinsAMDGPU.td

AMDGPU: Add named ArgRange classes for common builtin operands (#242552)

Name the ranges shared by many builtins after the operand they
constrain: byte/word select indexes, scale_sel, f8f6f4 matrix formats,
and wmma neg flags on variants that do not support negation. NFC.

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+58-53clang/include/clang/Basic/BuiltinsAMDGPU.td
+58-531 files

LLVM/project f795a17 — clang/include/clang/Basic BuiltinsAMDGPU.td, clang/lib/Sema SemaAMDGPU.cpp

AMDGPU: Use ArgRange for prefetch cache policy bounds (#242551)

Only the reserved th value check remains in Sema.

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+1-3clang/lib/Sema/SemaAMDGPU.cpp
+2-2clang/include/clang/Basic/BuiltinsAMDGPU.td
+3-52 files

LLVM/project 9fa789f — libclc/opencl/lib/spirv/vulkan/shared vstore_half.inc vstore_half.cl

[libclc][spirv] Add double support to Vulkan vstore_half/vstorea_half (#242829)

Implement `double` overloads for `vstore_half` and `vstorea_half` under
`cl_khr_fp64`. Round each element with the Vulkan boundary checks, then
forward it as `float` to the existing `vstore_half_N` and
`vstorea_half_N` helpers.

Prerequisite for google/clspv#1752; end-to-end tests will be added there
since `libclc/test` currently targets only AMDGPU.

I used AI assistance to prepare and review this patch.
I reviewed the entire change and take full responsibility for this PR.

Assisted-by: Antigravity Gemini 4 Hydrogen Extra reasoning
Assisted-by: Claude Code Opus 5.5 Max reasoning
DeltaFile
+92-5libclc/opencl/lib/spirv/vulkan/shared/vstore_half.cl
+2-2libclc/opencl/lib/spirv/vulkan/shared/vstore_half.inc
+94-72 files

LLVM/project c74b358 — llvm/lib/Support KnownFPClass.cpp, llvm/test/Transforms/Attributor nofpclass-constrained-fadd-fsub.ll nofpclass-fadd-fsub.ll

[KnownFPClass] improve deductions for fadd_self (#239257)

`fadd_self` is just multiplication by two. I removed the call to
`fadd_impl` and replaced it with the optimal conditions to rule out each
class, which improved deductions around NaN, infinity, and normal
classes. These refinements are valid for all rounding modes.

`fadd_impl` could not rule out NaN if both infinities were possible for
`fadd_self`: `fadd` produces NaN for `+inf + -inf` and `-inf + +inf`,
which are both impossible for `fadd_self`.

I avoided using `ldexp` so we do not have to pass in the `APFloat`
semantics into `fadd_self`.
DeltaFile
+45-15llvm/test/Transforms/Attributor/nofpclass-fadd-fsub.ll
+18-2llvm/lib/Support/KnownFPClass.cpp
+8-8llvm/test/Transforms/Attributor/nofpclass-constrained-fadd-fsub.ll
+71-253 files

LLVM/project ecf2c3d — llvm/tools/llvm-strings llvm-strings.cpp

Merge branch 'users/hvdijk/llvm-strings-unicode' into users/hvdijk/llvm-strings-encoding-utf16-utf32
DeltaFile
+2-4llvm/tools/llvm-strings/llvm-strings.cpp
+2-41 files

LLVM/project 10e0a31 — llvm/lib/Transforms/Vectorize SLPVectorizer.cpp, llvm/test/Transforms/SLPVectorizer revec.ll

[SLP] Keep original type for values with non-demoted vectorized users

A vectorized user, which stays in the original type, consumes the
extension of the demoted value with the wrong upper bits and may keep
poison-generating flags. Keep sext/zext nodes, demoted below their source
width, in the original type for such users, and check the flags of these
users for other demoted nodes.

Fixes #242864

Pull-request: https://github.com/llvm/llvm-project/pull/242915
DeltaFile
+37-4llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+8-8llvm/test/Transforms/SLPVectorizer/X86/minbw-non-demoted-vectorized-user.ll
+3-4llvm/test/Transforms/SLPVectorizer/X86/minbw-and-mask-unsigned-operand.ll
+1-2llvm/test/Transforms/SLPVectorizer/revec.ll
+49-184 files

LLVM/project c90a8d2 — llvm/lib/Transforms/Vectorize VPlanUtils.h VPlanUtils.cpp, llvm/test/Transforms/LoopVectorize if-pred-non-void.ll

[VPlan] Don't pack predicated values only used as scalars. (#242903)

When only scalars are used, avoid the vector round trip by skipping
packing the scalars in a vector, and instead using them via their scalar
phis.

Add a helper to determine whether only scalars are used, to be re-use in
follow-up.
DeltaFile
+6-14llvm/test/Transforms/LoopVectorize/if-pred-non-void.ll
+10-6llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp
+8-0llvm/lib/Transforms/Vectorize/VPlanUtils.cpp
+4-0llvm/lib/Transforms/Vectorize/VPlanUtils.h
+28-204 files

LLVM/project e8cb9b8 — llvm/lib/CodeGen MachineBasicBlock.cpp, llvm/test/CodeGen/X86 lea-fixup-debug-instrs.mir

[CodeGen] Stop trailing debug instructions from changing liveness queries (#235667)

When `computeRegisterLiveness` exhausts its bounded forward scan on the
block's last ordinary instruction, a trailing debug instruction or
pseudo
probe leaves the iterator short of `end()`. The end-of-block successor
live-in check is missed, so the fallback scan can return `LQR_Live` or
`LQR_Unknown` where `LQR_Dead` is expected. In `X86FixupLEAs`, this
keeps a
two-address LEA instead of converting it to ADD.

Skip trailing debug instructions and pseudo probes before the
end-of-block
check. Extend the existing X86FixupLEAs MIR test with the exact
ten-instruction boundary. A C reproducer emits `leaq (%rax,%rsi), %rax`
with
`-g` and `addq %rsi, %rax` with `-g0`; the patch makes both use ADD.

This issue was found by a non-AI automated testing tool. AI assisted
with the analysis and development of the fix.
DeltaFile
+58-0llvm/test/CodeGen/X86/lea-fixup-debug-instrs.mir
+3-0llvm/lib/CodeGen/MachineBasicBlock.cpp
+61-02 files

LLVM/project 0c221c2 — llvm/lib/Target/ARM ARMBaseInstrInfo.cpp, llvm/test/CodeGen/ARM cmp1-peephole-thumb.mir

[ARM] Preserve Thumb1 compare elimination across debug instructions (#237505)

A debug value between a Thumb1 multiply and compare prevents the
existing `MULS/MOVS/MOVS/CMP` reorder. As a result, debug builds retain
a redundant compare that is eliminated without debug information.

Move the intervening `MOVS` instructions before the multiply instead of
moving the multiply past the debug value. This keeps debug values after
the definitions they describe while allowing the compare to be
eliminated.

Fixes #227925

This issue was found by a non-AI automated testing tool. AI assisted
with the analysis and development of the fix.
DeltaFile
+33-15llvm/test/CodeGen/ARM/cmp1-peephole-thumb.mir
+9-7llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
+42-222 files

LLVM/project 9354118 — llvm/tools/llvm-strings llvm-strings.cpp

Fixes for crtomb
DeltaFile
+2-4llvm/tools/llvm-strings/llvm-strings.cpp
+2-41 files

LLVM/project a45fa42 — llvm/lib/CodeGen/SelectionDAG DAGCombiner.cpp, llvm/lib/Target/X86 X86ISelLowering.h X86ISelLowering.cpp

[X86] Mark vXi64 int to fp undesirable without AVX512DQ

Without avx512dq there is no vector conversion from i64 elements to f32
or f64, so widening the conversion of a source truncated with nsw or nuw
back to i64 makes it slower.

avx512fp16 converts i64 elements to f16 directly, so the widening folds
now pass the node and the check sees the result type.

Assisted-by: Claude Code Opus 5.5
DeltaFile
+63-128llvm/test/CodeGen/X86/combine-uitofp.ll
+32-130llvm/test/CodeGen/X86/combine-sitofp.ll
+10-76llvm/test/CodeGen/X86/avx512fp16-int-to-fp-trunc.ll
+10-0llvm/lib/Target/X86/X86ISelLowering.cpp
+2-4llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+1-0llvm/lib/Target/X86/X86ISelLowering.h
+118-3386 files

LLVM/project 99dafcb — llvm/lib/CodeGen/SelectionDAG DAGCombiner.cpp, llvm/test/CodeGen/X86 avx512fp16-int-to-fp-trunc.ll combine-uitofp.ll

[DAGCombiner] Mark uint_to_fp widened through trunc nuw as nneg

The source of a trunc nuw fits in a strictly narrower type, so it is
non-negative. Without nneg x86 lowers the widened conversion through the
unsigned i64 expansion.

Assisted-by: Claude Code Opus 5.5
DeltaFile
+12-74llvm/test/CodeGen/X86/combine-uitofp.ll
+6-3llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+1-1llvm/test/CodeGen/X86/avx512fp16-int-to-fp-trunc.ll
+19-783 files

LLVM/project 559ff40 — llvm/test/CodeGen/X86 combine-sitofp.ll avx512fp16-int-to-fp-trunc.ll

[NFC][X86] Add tests for int to fp of a trunc nuw or nsw source

Without avx512dq a vector i64 source truncated with nsw or nuw is
converted one element at a time or through the unsigned i64 expansion.
A scalar source truncated with nuw takes the expansion without avx512f.
avx512fp16 converts i64 to half directly even without avx512dq.

Assisted-by: Claude Code Opus 5.5
DeltaFile
+585-0llvm/test/CodeGen/X86/combine-uitofp.ll
+319-0llvm/test/CodeGen/X86/avx512fp16-int-to-fp-trunc.ll
+310-4llvm/test/CodeGen/X86/combine-sitofp.ll
+1,214-43 files

LLVM/project 8424f38 — llvm/test/Transforms/SLPVectorizer/X86 minbw-non-demoted-vectorized-user.ll

[SLP][NFC]Add tests with incorrect nsw propagations, NFC

Pull-request: https://github.com/llvm/llvm-project/pull/242904
DeltaFile
+97-0llvm/test/Transforms/SLPVectorizer/X86/minbw-non-demoted-vectorized-user.ll
+97-01 files

LLVM/project 76baf09 — llvm/lib/Transforms/Vectorize VPlanUtils.cpp, llvm/test/Transforms/LoopVectorize/X86 replicating-load-store-costs.ll

[VPlan] Support non-constant steps for VPScalarIVSteps in getSCEVExpr (#242896)

The IV operand of a VPScalarIVStepsRecipe already advances by the
recipe's step in each iteration, so its SCEV is the recipe's value for
the first lane of the current scalar iteration, independent of the step.
Return it for any step, instead of only constant steps.

Also return SCEVCouldNotCompute for recipes with a start index, which
add StartIndex * Step. Start indices are only set by unrolling and
replication, after the users of getSCEVExprForVPValue that pass a loop,
so this is defensive and does not change behavior.

The only use is the VPlan-based cost model, and VPRelpicateRecipes fall
back to legacy cost model in fewer places with the change.
DeltaFile
+20-73llvm/test/Transforms/LoopVectorize/X86/replicating-load-store-costs.ll
+7-7llvm/test/Transforms/LoopVectorize/X86/CostModel/replicating-load-non-constant-iv-step-cost.ll
+3-2llvm/lib/Transforms/Vectorize/VPlanUtils.cpp
+30-823 files

LLVM/project d14e9cc — llvm/test/Transforms/LoopVectorize if-pred-non-void.ll, llvm/test/Transforms/LoopVectorize/AArch64 early_exit_costs.ll predication_costs.ll

[LV] Add tests for predicated udivs used by replicated recipes (NFC). (#242895)

Add tests where a predicated udiv with various uses in different regions
and cost tests
DeltaFile
+509-0llvm/test/Transforms/LoopVectorize/if-pred-non-void.ll
+225-0llvm/test/Transforms/LoopVectorize/AArch64/predication_costs.ll
+100-0llvm/test/Transforms/LoopVectorize/AArch64/early_exit_costs.ll
+834-03 files

LLVM/project ff3345f — llvm/test/Analysis/LoopAccessAnalysis forked-pointers.ll predicated-stores-same-ptr.ll, llvm/test/Transforms/LoopVectorize interleaved-accesses.ll

[LAA] Add tests for miscompiles and monotonic bounds (NFC). (#242898)

Add a number of tests for cases where LAA currently computes incorrect
results: access size ignored in isSafeDependenceDistance, unchecked
dependences between multiple stores through the same pointer, and header
phis with a loop-varying latch value treated as forks.

Also add tests for non-affine pointers clamped with umin/umax/smin/smax
and zext, including cases that must not be bounded.
DeltaFile
+479-0llvm/test/Analysis/LoopAccessAnalysis/non-affine-monotonic-bounds.ll
+237-0llvm/test/Analysis/LoopAccessAnalysis/multiple-stores-same-pointer.ll
+146-0llvm/test/Analysis/LoopAccessAnalysis/predicated-stores-same-ptr.ll
+69-0llvm/test/Analysis/LoopAccessAnalysis/forked-pointers.ll
+55-0llvm/test/Transforms/LoopVectorize/interleaved-accesses.ll
+986-05 files

LLVM/project 603d845 — llvm/lib/Support KnownFPClass.cpp, llvm/test/Transforms/Attributor nofpclass-floor.ll nofpclass-ceil.ll

[KnownFPClass] Refine deductions for trunc/floor/ceil (#231368)

Follow up to https://github.com/llvm/llvm-project/pull/229982

Also refactors `KnownFPClass::roundToIntegral` to use the
`applyInputDenormalMode` helper.
DeltaFile
+92-17llvm/lib/Support/KnownFPClass.cpp
+64-14llvm/test/Transforms/Attributor/nofpclass-trunc.ll
+38-38llvm/test/Transforms/Attributor/nofpclass-roundtointegral-denormal.ll
+52-12llvm/test/Transforms/Attributor/nofpclass-ceil.ll
+30-20llvm/test/Transforms/Attributor/nofpclass-floor.ll
+276-1015 files

LLVM/project bc0683c — llvm/lib/Analysis ValueTracking.cpp, llvm/lib/CodeGen/GlobalISel GISelValueTracking.cpp

[ValueTracking][KnownFPClass] Support constrained fadd/fsub (#241060)

Adds a rounding mode parameter to `KnownFPClass::fadd` and
`KnownFPClass::fsub` to support `constrained_fadd`/`constrained_fsub`
and `G_STRICT_FADD`/`G_STRICT_FSUB`.
DeltaFile
+988-0llvm/test/Transforms/Attributor/nofpclass-constrained-fadd-fsub.ll
+76-53llvm/lib/Analysis/ValueTracking.cpp
+24-15llvm/lib/Support/KnownFPClass.cpp
+39-0llvm/test/CodeGen/AArch64/GlobalISel/knownfpclass-ops.mir
+15-5llvm/lib/CodeGen/GlobalISel/GISelValueTracking.cpp
+6-3llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
+1,148-761 files not shown
+1,153-797 files

LLVM/project d540d0a — llvm/include/llvm/IR InstrTypes.h, llvm/lib/IR Instructions.cpp

[IR] Allow bitcasts between bytes and pointers in `isBitOrNoopPointerCastable`
DeltaFile
+7-7llvm/test/Transforms/InstCombine/load-store-forward.ll
+6-4llvm/test/Transforms/MergedLoadStoreMotion/st_sink_conflict_type.ll
+7-2llvm/include/llvm/IR/InstrTypes.h
+8-0llvm/lib/IR/Instructions.cpp
+1-1llvm/test/Transforms/InstCombine/load.ll
+29-145 files

LLVM/project 13819ef — llvm/test/Transforms/InstCombine load.ll load-store-forward.ll, llvm/test/Transforms/MergedLoadStoreMotion st_sink_conflict_type.ll

[InstCombine][MergedLoadStoreMotion] Add tests for casts between bytes and pointers (NFC)
DeltaFile
+110-0llvm/test/Transforms/InstCombine/load-store-forward.ll
+58-0llvm/test/Transforms/MergedLoadStoreMotion/st_sink_conflict_type.ll
+50-0llvm/test/Transforms/InstCombine/load.ll
+218-03 files

LLVM/project f72b4f2 — llvm/lib/Transforms/Scalar MergedLoadStoreMotion.cpp, llvm/test/Transforms/MergedLoadStoreMotion st_sink_conflict_type.ll

[MergedLoadStoreMotion] Don't drop provenance or spread poison when sinking stores
DeltaFile
+37-31llvm/test/Transforms/MergedLoadStoreMotion/st_sink_conflict_type.ll
+46-11llvm/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp
+83-422 files

LLVM/project 8027dcf — llvm/test/Transforms/MergedLoadStoreMotion st_sink_conflict_type.ll

[MergedLoadStoreMotion] Add tests for sinking stores of bytes and vectors (NFC)
DeltaFile
+270-0llvm/test/Transforms/MergedLoadStoreMotion/st_sink_conflict_type.ll
+270-01 files

LLVM/project 66be255 — llvm/lib/Analysis Loads.cpp, llvm/test/Transforms/InstCombine load.ll

[Loads] Don't reuse non-byte loads for byte loads
DeltaFile
+6-6llvm/test/Transforms/InstCombine/load.ll
+6-0llvm/lib/Analysis/Loads.cpp
+12-62 files

LLVM/project 61033fb — llvm/test/Transforms/InstCombine load.ll

[InstCombine] Add tests for reusing loads for byte loads (NFC)
DeltaFile
+72-0llvm/test/Transforms/InstCombine/load.ll
+72-01 files

LLVM/project 306764e — llvm/test/Transforms/LoopVectorize/X86/CostModel replicating-load-non-constant-iv-step-cost.ll

[LV] Add test with hoisted loads using an IV with non-const step (NFC) (#242871)

Add a test checking the cost of complementary predicated loads that are
hoisted and whose address is based on an induction with a non-constant
step, which cannot be versioned.
DeltaFile
+51-0llvm/test/Transforms/LoopVectorize/X86/CostModel/replicating-load-non-constant-iv-step-cost.ll
+51-01 files