LLVM/project 759b637 — clang/lib/CodeGen CGExprScalar.cpp CGPointerAuth.cpp, clang/test/CodeGen ptrauth-qualifier-atomic.c

[clang][PAC] Fix crashes on _Atomic __ptrauth-qualified objects (#240294)

Implicit `_Atomic` operations on a `__ptrauth`-qualified object assert
in CodeGen, because the pointer-authentication helpers do not look
through `AtomicType`: https://godbolt.org/z/6KE7Ez5P4 (a trunk build, so
the link stops crashing once this lands).

Fix the crashes. In a build without assertions the same code miscompiled
an `_Atomic` function pointer under `-fptrauth-calls`, signing it twice
or leaving it unsigned. Nothing else changes: the tests simply document
current behavior, with a FIXME on what I propose fixing in follow-ups,
for example https://godbolt.org/z/hGosq14ea.

Assisted-by: AI
DeltaFile
+277-0clang/test/CodeGen/ptrauth-qualifier-atomic.c
+2-1clang/lib/CodeGen/CGPointerAuth.cpp
+1-1clang/lib/CodeGen/CGExprScalar.cpp
+280-23 files

LLVM/project 90ebdc7 — llvm/test/Transforms/LowerTypeTests export-single.ll export-icall.ll

[spr] update

Created using spr 2.0.0-beta.2
DeltaFile
+6-6llvm/test/Transforms/LowerTypeTests/export-inline.ll
+4-4llvm/test/Transforms/LowerTypeTests/export-bytearray.ll
+4-4llvm/test/Transforms/LowerTypeTests/export-allones.ll
+2-2llvm/test/Transforms/LowerTypeTests/export-single.ll
+2-2llvm/test/Transforms/LowerTypeTests/export-icall.ll
+2-2llvm/test/Transforms/LowerTypeTests/export-dead.ll
+20-202 files not shown
+22-228 files

GhostBSD/ghostbsd 30bcc0b — sys/dev/usb/input usbhid.c

usbhid: Retry fetching the report descriptor

So far only seen with a wireless mouse on a Logitech Unifying
receiver. The receiver can time out on GET_DESCRIPTOR(REPORT) while
still starting up after power is applied, for example after resume
or when switched back through a USB switch. On failure, hms falls
back to the boot protocol descriptor and the mouse loses its wheel.
Wired mice have not shown the problem.

Retry the request up to five times with a 100 ms pause, stopping
early on a stall since that means the device has no descriptor.
Linux usbhid retries this request in the same way.
DeltaFile
+15-3sys/dev/usb/input/usbhid.c
+15-31 files

GhostBSD/ghostbsd 6dc2f46 — sys/dev/usb/input usbhid.c

usbhid: Retry fetching the report descriptor

So far only seen with a wireless mouse on a Logitech Unifying
receiver. The receiver can time out on GET_DESCRIPTOR(REPORT) while
still starting up after power is applied, for example after resume
or when switched back through a USB switch. On failure, hms falls
back to the boot protocol descriptor and the mouse loses its wheel.
Wired mice have not shown the problem.

Retry the request up to five times with a 100 ms pause, stopping
early on a stall since that means the device has no descriptor.
Linux usbhid retries this request in the same way.
DeltaFile
+15-3sys/dev/usb/input/usbhid.c
+15-31 files

LLVM/project 791cd7a — llvm/include/llvm/Analysis TargetTransformInfoImpl.h TargetTransformInfo.h, llvm/lib/Analysis TargetTransformInfo.cpp

[DSE][AMDGPU] Remove dead LDS writes at wave exit

LDS is freed once every wave of a work-group has terminated, and a
wave terminates when its entry function returns. Other waves can only
observe its LDS writes through a synchronizing operation. DSE still
kept every such write, because it treats LDS like any other global.

Add a TTI hook that reports address spaces whose writes cannot be
observed once a function returns, and let DSE treat globals in them
like allocas at function exit. AMDGPU reports LDS in entry functions.
Loads, barriers, fences, atomics and calls still keep earlier writes.

Change-Id: I3147eae461cf85e9e1f15d5626266c496fb4c430
Co-Authored-By: Claude Fable 5.2 <noreply at anthropic.com>
DeltaFile
+22-6llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+0-9llvm/test/Transforms/DeadStoreElimination/AMDGPU/lds-dead-at-return.ll
+9-0llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
+5-0llvm/lib/Analysis/TargetTransformInfo.cpp
+5-0llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
+5-0llvm/include/llvm/Analysis/TargetTransformInfo.h
+46-151 files not shown
+49-157 files

LLVM/project cf23905 — llvm/test/Transforms/DeadStoreElimination/AMDGPU lds-dead-at-return.ll

[DSE][AMDGPU] Add LDS store-at-exit tests (NFC)

DSE keeps LDS writes that nothing reads or synchronizes before an
entry function returns. Record the current behavior before changing
it.

Change-Id: If7c568ce3aec9e7fe847fccd6698ac71733b2364
Co-Authored-By: Claude Fable 5.2 <noreply at anthropic.com>
DeltaFile
+194-0llvm/test/Transforms/DeadStoreElimination/AMDGPU/lds-dead-at-return.ll
+194-01 files

LLVM/project f3da3d5 — llvm/include/llvm/CodeGen RuntimeLibcallUtil.h, llvm/lib/CodeGen TargetLoweringBase.cpp

CodeGen: Share atomic libcall selection between the legalizers (#239083)

SelectionDAG and GlobalISel each had their own copies of the choice
between an outline atomic and a __sync_* call. Move it into a common
helper.

The __sync_* call is now always looked up in the DAG's libcall info,
rather than sometimes in the TargetLowering defaults. Also disable
the untested __sync call case in GlobalISel.

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+38-56llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
+11-6llvm/include/llvm/CodeGen/RuntimeLibcallUtil.h
+6-10llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+4-11llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
+11-1llvm/lib/CodeGen/TargetLoweringBase.cpp
+70-845 files

GhostBSD/ghostbsd d02482a — sys/dev/usb/input usbhid.c

Merge pull request #390 from ghostbsd/usbhid-rdesc-retry

usbhid: Retry fetching the report descriptor
DeltaFile
+15-3sys/dev/usb/input/usbhid.c
+15-31 files

FreeBSD/ports da6966f — devel/py-expression distinfo Makefile

devel/py-expression: Update to 6.0.1

Changelog: https://github.com/dbrattli/Expression/blob/v6.0.1/CHANGELOG.md

Reported by:    portscout
DeltaFile
+3-3devel/py-expression/distinfo
+3-3devel/py-expression/Makefile
+6-62 files

LLVM/project ad4ad61 — clang/lib/CodeGen CGClass.cpp, clang/test/CodeGenCXX cfi-vtable-check.cpp

[spr] update

Created using spr 2.0.0-beta.2
DeltaFile
+6-6clang/test/CodeGenCXX/cfi-vtable-check.cpp
+2-3clang/lib/CodeGen/CGClass.cpp
+8-92 files

LLVM/project 30c5186 — compiler-rt/test/cfi devirtualize-speculatively.cpp

Rebase

Created using spr 2.0.0-beta.2
DeltaFile
+0-3compiler-rt/test/cfi/devirtualize-speculatively.cpp
+0-31 files

LLVM/project e8c5b66 — clang/lib/CodeGen CGClass.cpp, clang/test/CodeGenCXX cfi-stats.cpp

[Clang][CFI] Don't report sanitizer stats for unchecked VFE loads (#241641)

With virtual function elimination (3b598b9c867a),
`EmitVTableTypeCheckedLoad` is also used for calls that have no
`cfi-vcall` check, such as calls in `no_sanitize("cfi-vcall")` functions
or on ignorelisted classes. It reported `-fsanitize-stats` for these
calls anyway, so the stats counted checks that were never performed.

Report stats only when the check is emitted.

Assisted-by: Gemini
DeltaFile
+2-2clang/test/CodeGenCXX/cfi-stats.cpp
+1-2clang/lib/CodeGen/CGClass.cpp
+3-42 files

LLVM/project f28b058 — mlir/lib/Dialect/Vector/IR VectorOps.cpp, mlir/lib/Dialect/Vector/Transforms VectorMaskElimination.cpp

[mlir][vector] Handle rank zero case in resolveAllTrueCreateMaskOp (#240128)

- handle rank-0 case in `resolveAllTrueCreateMaskOp` that crashed
assuming operand count equals rank, which isn't true in the case of
rank-0.

- now `resolveAllTrueCreateMaskOp` handles rank-0 case the same way
`CreateMaskFolder` does, by using a shape of {1} with scalable flags
{false}, reused the existing pattern for consistency.

- fix `ConstantMaskOp::build` bug @FedericoBruzzone pointed out. now the
builder passes {1} for `AllTrue`, {0} for `AllFalse` when the rank is 0
and produces valid IR.

- add repro and constant rank 0 case as regression test .

fixes #240008 crash

Co-authored-by: Andrzej Warzyński <andrzej.warzynski at gmail.com>
DeltaFile
+21-0mlir/test/Dialect/Vector/eliminate-masks.mlir
+6-4mlir/lib/Dialect/Vector/IR/VectorOps.cpp
+8-0mlir/lib/Dialect/Vector/Transforms/VectorMaskElimination.cpp
+35-43 files

LLVM/project 2515127 — lldb/include/lldb/Core Debugger.h, lldb/source/Core Debugger.cpp

[lldb] Suggest 'bugreport' after errors that may be LLDB bugs (#241615)

Errors that were likely caused by an LLDB bug ended in ad-hoc variations
of "please file a bug and attach the file at the start of this error
message". Report them with the new Debugger::ReportInternalError
instead, which follows the error with one shared note:

```
note: if you believe this is a bug, use the 'bugreport' command
```

Each debugger shows the note once per distinct failure, deduplicated
with the same ThreadSafeDenseSet that Module uses for its own
diagnostics. The new diagnostics.suggest-bugreport setting turns the
note off. Because the note is part of the event message, the setting
also suppresses it for SB clients such as lldb-dap.

Assisted-by: Claude
DeltaFile
+60-0lldb/unittests/Core/DiagnosticEventTest.cpp
+16-24lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+10-21lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+22-5lldb/source/Core/Debugger.cpp
+11-12lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+20-1lldb/include/lldb/Core/Debugger.h
+139-6314 files not shown
+196-8720 files

LLVM/project 5f2b464 — llvm/lib/Target/RISCV/GISel RISCVCallLowering.cpp, llvm/test/CodeGen/RISCV kcfi-isel-mir.ll kcfi.ll

[RISCV][GlobalISel] Preserve KCFI type on indirect calls (#240364)

The commit propagates `CallLoweringInfo::CFIType` to the call
instruction in GlobalISel so the KCFI pass can emit indirect-call
checks, matching SelectionDAG lowering.

AI Usage: Assisted by Amp (Opus 5.5)
Reproducer: https://godbolt.org/z/M14bnYqKn

---------

Co-authored-by: Amp <amp at ampcode.com>
DeltaFile
+236-0llvm/test/CodeGen/RISCV/kcfi.ll
+23-0llvm/test/CodeGen/RISCV/kcfi-isel-mir.ll
+2-0llvm/lib/Target/RISCV/GISel/RISCVCallLowering.cpp
+261-03 files

LLVM/project c99a67c — llvm/test/Transforms/SLPVectorizer/AMDGPU packed-fp32-softmax.ll

[AMDGPU] Precommit test before making gfx1250 packed FP32 shuffles free (#241409)

Precommit test before https://github.com/llvm/llvm-project/pull/240999
is reviewed.

---------

Co-authored-by: Tim Gymnich <tim at gymni.ch>
DeltaFile
+171-0llvm/test/Transforms/SLPVectorizer/AMDGPU/packed-fp32-softmax.ll
+171-01 files

NetBSD/src StKWawM — sys/dev/ic wdc.c

   Fix typo in 1.313/1.311
VersionDeltaFile
1.318+3-3sys/dev/ic/wdc.c
+3-31 files

LLVM/project 473f6ad — llvm/lib/Transforms/IPO ForceFunctionAttrs.cpp, llvm/test/Transforms/ForcedFunctionAttrs forced.ll

[IR] Make optnone imply noinline (#228169)

Previously the verifier required every `optnone` function to also carry
`noinline`. Instead, make `optnone` imply `noinline` so the pairing is
no
longer necessary.

To avoid each user having to remember to check both attributes, add
`Function::isNoInline()` (true for `noinline` or `optnone`) and make
`CallBase::isNoInline()` defer to it for the callee. Existing direct
queries of `Attribute::NoInline` on functions are migrated to the
helper.

The verifier now explicitly rejects `alwaysinline` + `optnone`, which
was
previously only enforced transitively via the `noinline` requirement.
ForceFunctionAttrs and llvm-reduce no longer need to keep the two
attributes paired.

Assisted-By: Claude
DeltaFile
+37-16llvm/test/Transforms/ForcedFunctionAttrs/forced.ll
+36-0llvm/test/Transforms/Inline/inline-optnone.ll
+36-0llvm/test/Transforms/Inline/always-inline-optnone.ll
+23-0llvm/test/Verifier/optnone.ll
+3-19llvm/lib/Transforms/IPO/ForceFunctionAttrs.cpp
+0-15llvm/tools/llvm-reduce/deltas/ReduceAttributes.cpp
+135-5020 files not shown
+192-8326 files

LLVM/project d0a9e4e — llvm/include/llvm/Target Target.td, llvm/test/TableGen RegClassByHwMode.td AsmMatcherCoerceFromRegClass.td

[nspr] initial commit
DeltaFile
+46-16llvm/utils/TableGen/AsmMatcherEmitter.cpp
+37-0llvm/test/TableGen/AsmMatcherCoerceFromRegClass.td
+26-2llvm/test/TableGen/RegClassByHwMode.td
+6-1llvm/include/llvm/Target/Target.td
+115-194 files

LLVM/project 12532d5 — llvm/include/llvm/IR GlobalValue.h, llvm/lib/IR Verifier.cpp ConstantsContext.h

[IR] Skip removeDeadConstantUsers use-list walks to save ~0.25% wall time (#240626)

GlobalOpt's `deleteIfDead` calls `removeDeadConstantUsers()` on every
global before checking whether it is dead. For a function, that walks
the whole use list, which is mostly call sites, and loads each user only
to find that it is an instruction. Those loads usually miss in cache. In
AMD IBS profiles of `opt -O2` on four large LLVM TUs (X86ISelLowering,
AArch64ISelLowering, DAGCombiner, ScalarEvolution),
`removeDeadConstantUsers` accounts for 10-19% of the loads served from
L3 or DRAM, but only about 0.5% of cycles.

Only constants that are not globals can be dead users, and with opaque
pointers most functions have none. This patch adds a `GlobalValue` bit,
`MayHaveConstantUsers`. The bit is set when such a constant takes the
global as an operand: in `ConstantUniqueMap::create` and
`replaceOperandsInPlace`, and for `DSOLocalEquivalent` and `NoCFIValue`.
`removeDeadConstantUsers` returns immediately when the bit is clear. It
clears the bit after a walk that leaves no live non-global constant
users. Only those constant-creation paths set the bit, and they are

    [18 lines not shown]
DeltaFile
+45-0llvm/unittests/IR/ConstantsTest.cpp
+19-3llvm/include/llvm/IR/GlobalValue.h
+18-0llvm/lib/IR/Constants.cpp
+13-0llvm/lib/IR/ConstantsContext.h
+9-0llvm/lib/IR/Verifier.cpp
+104-35 files

LLVM/project 2575677 — llvm/lib/Target/RISCV RISCVRegisterInfo.td, llvm/test/TableGen AsmMatcherCoerceFromRegClass.td

[nspr] initial commit
DeltaFile
+105-15llvm/test/TableGen/AsmMatcherCoerceFromRegClass.td
+6-0llvm/lib/Target/RISCV/RISCVRegisterInfo.td
+111-152 files

LLVM/project 9862340 — llvm/test/TableGen AsmMatcherCoerceFromRegClass.td, llvm/utils/TableGen AsmMatcherEmitter.cpp

[nspr] initial commit
DeltaFile
+22-4llvm/utils/TableGen/AsmMatcherEmitter.cpp
+10-0llvm/test/TableGen/AsmMatcherCoerceFromRegClass.td
+32-42 files

NetBSD/src cAfQUPJ — sys/arch/m68k/m68k pmap_68k.c

   Update to reflect cesfic status.
VersionDeltaFile
1.87+7-6sys/arch/m68k/m68k/pmap_68k.c
+7-61 files

LLVM/project 81dba15 — llvm/lib/Analysis MemoryBuiltins.cpp

[MemoryBuiltins] Check alloc/free type first to save ~0.1% instrs (#240677)

Profiling showed that `isAlloc*Fn` and `getFreedOperand` execute many
instructions to detect malloc-like and free-like instructions.

Rejecting calls with the wrong return type before querying attributes
and TargetLibraryInfo in these allocator classification routines reduces
opt's user instruction count by about 0.5% on a call-heavy InstCombine
microbenchmark, with no change in output.

Allocation functions return a pointer to the new block of memory, and
deallocation functions return void: LangRef requires this of
`allockind("free")` functions, and `isLibFreeFunction` already requires
it of library free functions. InstCombine calls `getFreedOperand` and
`isRemovableAlloc` on every call it visits, so the `nobuiltin`,
`allockind`, and TLI queries that these checks skip add up.

Compile-time tracker:
https://llvm-compile-time-tracker.com/compare.php?from=6e58f6f5536016c55365ac55be11e6ac783d64cf&to=bbbd87d2271c7f02d7bca8f881220647da532d99&stat=instructions:u

    [6 lines not shown]
DeltaFile
+14-0llvm/lib/Analysis/MemoryBuiltins.cpp
+14-01 files

NetBSD/src bycQhDo — sys/arch/cesfic/conf std.cesfic

   Enable __HAVE_NEW_PMAP_68K by default on cesfic.
VersionDeltaFile
1.8+2-2sys/arch/cesfic/conf/std.cesfic
+2-21 files

NetBSD/src CyRCibv — sys/arch/cesfic/cesfic autoconf.c sic6351.c, sys/arch/cesfic/dev zs_pcc.c

   Minimum changes needed to convert cesfic to use the new pmap_68k.
VersionDeltaFile
1.95+25-6sys/arch/cesfic/cesfic/machdep.c
1.10+6-9sys/arch/cesfic/dev/zs_pcc.c
1.76+13-1sys/arch/cesfic/cesfic/locore.s
1.7+5-7sys/arch/cesfic/cesfic/sic6351.c
1.31+7-2sys/arch/cesfic/cesfic/autoconf.c
1.9+5-1sys/arch/cesfic/include/pmap.h
+61-264 files not shown
+71-3210 files

LLVM/project ae45eda — llvm/lib/Analysis InstructionSimplify.cpp

[InstSimplify] Check call args are constant first to save ~0.04% instrs (#240676)

`tryConstantFoldCall` runs two checks before continuing to fold:
1. It calls `canConstantFoldCallTo`, which checks if the call is marked
nobuiltin and that it is a known library call (cached)
2. It scans the arguments and bails out if any of them are non-Constant

It turns out that querying attributes and TLI is more expensive than
scanning for Constant arguments, so do that first. This patch swaps the
order so the common case exits early.

Compile-time tracker:
https://llvm-compile-time-tracker.com/compare.php?from=6e58f6f5536016c55365ac55be11e6ac783d64cf&to=ebc6a8a748f0d3338efc8c2633f057418ebca43a&stat=instructions:u

This is worth ~0.15% on my workload, but only ~0.04% on the CTT Clang
build. Again, I think this might show that my workload is intrinsic-call
heavy, but I haven't confirmed that yet.

LLM-aided
DeltaFile
+7-1llvm/lib/Analysis/InstructionSimplify.cpp
+7-11 files

FreeBSD/src a2a0ded — sys/dev/tpm tpm20.h tpm20.c

tpm: crb: Support the ACPI start method

Some AMD firmware TPMs report StartMethod 2 and had no driver. They never
acknowledge CTRL_REQ, so skip the idle and ready requests.

Do not harvest entropy from these TPMs on AMD: on a Ryzen 7 7735HS each
periodic TPM2_GetRandom froze every CPU, for up to 1.2 s (AMD PA-410).

Reviewed by:    kbowling
Approved by:    kbowling
Differential Revision:  https://ron-dev.freebsd.org/FreeBSD/src/pulls/103

(cherry picked from commit 6af18560a124b84549713a5f2b667a1df0990929)
DeltaFile
+92-3sys/dev/tpm/tpm_crb.c
+11-6sys/dev/tpm/tpm20.c
+1-0sys/dev/tpm/tpm20.h
+104-93 files

FreeBSD/src 9a31307 — sys/dev/tpm tpm_crb.c

tpm_crb: Use locality registers only with plain CRB

The locality release wait times out on every command on a Framework 13
(Pluton start method), logging every 10 seconds.

Reported by:    emaste, tuexen
Reviewed by:    kbowling
Approved by:    kbowling
Fixes:          bfe4be85a935 ("tpm_crb: wait for idle and locality release after each command")

(cherry picked from commit 1dade7024457ee10df1ccae22e3c454e80f82b76)
DeltaFile
+11-5sys/dev/tpm/tpm_crb.c
+11-51 files

FreeBSD/src 052e37a — sys/dev/tpm tpm_crb.c

tpm_crb: wait for idle and locality release after each command

transmit only requested GO_IDLE and the locality release, so a back-to-back
command could see stale state and fail with EIO.
A post-send idle timeout no longer discards a completed response.

Reviewed by:    kbowling
Approved by:    kbowling
Differential Revision:  https://ron-dev.freebsd.org/FreeBSD/src/pulls/93

(cherry picked from commit bfe4be85a9354b92135e105028f2e1b3e0307ada)
DeltaFile
+32-7sys/dev/tpm/tpm_crb.c
+32-71 files