[LV] Support reductions in early exit loops not used on early exits. (#232959)
Add initial support for reductions in early-exit loops, starting with
the first simple case: reductions where the result is only used in the
latch exit.
For such loops, we can continue computing the reduction result in the
middle block, and use it in the latch exit, like for regular loops.
PR: https://github.com/llvm/llvm-project/pull/232959
Remove the stale FollowCopyChain comment and unrelated comment changes
The comment that explained FollowCopyChain's walk was left above
visitCallBrLandingPad() when the walk was removed. Also put the BTI comment
in visitCallBr() back as it was, and fix a double space.
Assisted-by: Claude Opus 5.5
[IVDescriptors] Reject min/max reduction with escaping store. (#235582)
getMinMaxRecurrence did not validate the stored value and allowed
storing values other than the reduction backedge value.
Mirror the legacy AddReductionVar and only allow storing the backedge
value to fix miscompile.
[BPF] Test jump tables with the static relocation model too (#235212)
The entries of a BPF jump table are addresses of blocks in each
relocation model. Thus the code must not add the address of the table to
an entry. The fix is in #235214, and jump-table-pic.ll is its test.
The test runs llc with `-relocation-model=pic` only. The flag can
suggest that the fix is for position independent code only. Run the test
with `-relocation-model=static` too. The code is the same in the two
models.
[clang][unittests] Skip DeviceOffloadHIPTest.* on AIX and z/OS (#235580)
Convert `DeviceOffloadHIPTest.DeviceObjectIsGenerated` to a `TEST_F`
backed by a new fixture class that inherits from `InterpreterTestBase`,
consistent with `DeviceOffloadTest`. This pattern inherits the existing
mechanism to skip LLVM JIT tests on AIX and z/OS.
Avoids
```
LLVM ERROR: Incompatible object format!
```
Co-authored-by: Hubert Tong <hstong at ca.ibm.com>
[lldb] Fix posix_openpt() with O_CLOEXEC on OpenBSD (#235402)
OpenBSD's posix_openpt() fails with EINVAL if any flag other than
O_RDWR and O_NOCTTY is passed. ProcessLaunchInfo::SetUpPtyRedirection()
passes O_CLOEXEC, so lldb-server could not launch a process with its
stdio on a pseudo terminal, and the LLDBServerTests failed.
On OpenBSD, open the primary without O_CLOEXEC and set FD_CLOEXEC with
fcntl() afterwards.
Add a unit test that opens a pseudo terminal with O_CLOEXEC.
[SelectionDAG] Read callbr outputs from the INLINEASM_BR's registers
An indirect target of a callbr found the registers holding the asm's
outputs by walking back from the callbr's exported value through COPYs to
the INLINEASM_BR, and asserted that the chain held nothing else ("start of
copy chain MUST be COPY"). An output whose type differs from its register's,
such as a float in a general-purpose register, is converted, e.g. with
MOVDI2SSrr on x86, so the assertion fired. And the target didn't convert the
output to its result type, as visitInlineAsm() does.
After an error in the asm, nothing defines the exported value, so the walk
crashed, and the callbr block kept edges to the indirect targets with no
INLINEASM_BR to branch there, which later passes reject.
Record the registers that the INLINEASM_BR defines its outputs in when
lowering the callbr, and read the outputs from them in the indirect target,
converting each to its result type as visitInlineAsm() does. After an error,
give the indirect targets undefined outputs and no edges from the callbr.
Fixes #98379, #112914, #143795, #170100, #172657, and #173609.
[clang][test] cir-input-invalid.cir: Use POSIX BRE with `sed` instead of ERE
Versions of `sed` conforming to POSIX.1 prior to POSIX.1-2024 may
operate only on basic regular expressions.
Avoids
```
sed: illegal option -- E
```
on AIX.
[MISched] Add anti-dependency breaking to PostMachineScheduler
Port the post-RA anti-dependency breaker lifecycle to ScheduleDAGMI so
PostMachineScheduler can rename physical registers across scheduling
regions. Drive the StartBlock/Observe/BreakAntiDependencies/FinishBlock
sequence from the DAG, selecting the aggressive or critical breaker from
the subtarget's anti-dependency mode.
Add the -misched-postra-antidep override so the machinery can be tested
with llc, and cover a within-region WAR hazard with a RISC-V test that
contrasts the ANTIDEP and NO-ANTIDEP results.
Preserve MachineRegisterClassInfo across late AArch64 passes and the
RISC-V load/store optimizer, which only rewrite machine instructions,
so PostMachineScheduler can reuse the existing analysis result.
Assisted-by: TRAE CLI (GPT-5.6)
Reviewers:
[2 lines not shown]
[lldb] Fix FindFileTest on OpenBSD (#235405)
The test created its file with CD_CreateAlways and FA_Read, which
opens it with O_RDONLY | O_CREAT | O_TRUNC. POSIX leaves O_TRUNC
without O_WRONLY or O_RDWR undefined, and OpenBSD's open(2) rejects it
with EINVAL, as documented in the CAVEATS section of the man page, so
the test failed before testing anything.
The file is created in a freshly made unique directory, so there is
nothing to truncate. Use CD_OpenAlways, which only adds O_CREAT.
https://man.openbsd.org/open#CAVEATS
> The O_TRUNC flag requires that one of O_RDWR or O_WRONLY also be
> specified, else EINVAL is returned.
[PBQP] Report an error when inline asm needs more registers than available
When an inline asm needs more registers than are available, the other
register allocators report "inline assembly requires more registers than
available" and go on. PBQP instead tried to spill a register that can't be
spilled, which asserted in InlineSpiller ("Attempting to spill already
spilled value."), either for a register with no allowed registers or for
one that the solution spills. A problem with no solution of finite cost
could also assert first, in the solver's backpropagation, that a
conservatively allocatable node had a register option.
Move RegAllocBase's handling of a register that failed to allocate into a
function, assignFailedVirtReg(), and call it from PBQP for a register that
can't be spilled instead of spilling it. Exempt a node with no option of
finite cost from the solver's assertion.
Fixes #235566.
[InstSimplify] Fold nested FP min/max with a shared operand (#233365)
foldMinimumMaximumSharedOp only matched m(m(X, Y), X). Look through
nested calls of the same intrinsic so the shared operand can be found
deeper in the tree. The FP min/max intrinsics are commutative,
associative and idempotent (ignoring sNaN quieting, as the existing
folds already do), so if m(X, Z) == X then m(m(X, Y), Z) == m(X, Y).
```llvm
%ab = call float @llvm.maxnum.f32(float %a, float %b)
%abc = call float @llvm.maxnum.f32(float %ab, float %c)
%r = call float @llvm.maxnum.f32(float %abc, float %a)
-->
%r = %abc
```
[clang][unittests] Skip DeviceOffloadHIPTest.* on AIX and z/OS
Convert `DeviceOffloadHIPTest.DeviceObjectIsGenerated` to a `TEST_F`
backed by a new fixture class that inherits from `InterpreterTestBase`,
consistent with `DeviceOffloadTest`.
Avoids
```
LLVM ERROR: Incompatible object format!
```
[BPF] Mask the index into a jump table (#235214)
The verifier wants to see that the load from a jump table is within the
table. The range check doesn't always show that. The compare is done in
the type of the switch and the index is that value extended to 64 bits,
which can be two computations:
w1 = w7
w1 &= 255
if w1 > 24 goto ...
r1 = r7
r1 &= 255
r1 <<= 3
r2 = BPF.JT.0.0 ll
r2 += r1
r1 = *(u64 *)(r2 + 0) R2 max value is outside of the allowed memory
range
Make the size of the table a power of two, the new entries repeat the
[5 lines not shown]
[BPF] Give a switch whose default is unreachable a default (#235213)
There is no range check in front of a jump table when the default of the
switch is unreachable:
%v = load i8, ptr %p
switch i8 %v, label %default [ i8 0, label %c0 ... i8 15, label %c15 ]
default:
unreachable
w1 = *(u8 *)(r1 + 0)
r1 <<= 3
r2 = BPF.JT.0.0 ll
r2 += r1
r1 = *(u64 *)(r2 + 0)
gotox r1
The compiler knows that the value is one of the cases. The verifier
doesn't: "R2 max value is outside of the allowed memory range".
[8 lines not shown]
Merge tag 'parisc-for-7.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux
Pull parisc updates from Helge Deller:
- fix out-of-bounds read in eisa_enumerator driver
- drop redundant pte_xxx() macros and use common macros
- code cleanup in eisa_enumerator driver
- typo fixes in comments in various header files
* tag 'parisc-for-7.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
parisc: eisa_enumerator: Code and whitespace cleanups
parisc: eisa_enumerator: Fix out-of-bounds reads of the EEPROM buffer
parisc: Drop redundant implementation of ptep_set_wrprotect()
parisc: Drop redundant implementation of pte_same()
parisc: Drop own implementations for ptep_get() and ptep_test_and_clear_young()
parisc: fix typos in comments in parport.c
[8 lines not shown]
[clang][Driver] Don't let -save-temps overwrite the input file (#235413)
With -save-temps, an intermediate file named after the input can be the
input itself, e.g. the preprocessed output of a .s file on Darwin. The
driver catches this, but only checked for it when the output's name was
the input's file name. It missed two cases, and overwrote the input with
the preprocessed output:
- With -save-temps=obj, the output is in the output's directory, so
"clang -c -save-temps=obj sub/t.s -o sub/t.o" wrote "sub/t.s".
- On a case-insensitive file system, such as macOS's default, the
preprocessed output "t.s" of an input "t.S" is the same file.
Check whether the output is the same file as the input whenever temps
are saved.
Fixes #7002.
Merge tag 'sh-for-v7.4-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/glaubitz/sh-linux
Pull sh updates from John Paul Adrian Glaubitz:
"Fixes and improvements for various boards as well as the generic sh
kernel:
- help the mach-x3proto and ecovec24 boards get rid off the use of
the old platform data API in the kernel. For the former board,
software nodes are being used for gpio-keys now while for the
latter board, static device properties are used to describe the
touchscreen (Dmitry Torokhov)
- a build fix when CONFIG_BUILTIN_DTB is enabled, and fix an issue
with __get_user_u64() and __put_user_u64() using wrong memory
operands which could cause the kernel build to fail with "invalid
'asm'" or an internal compiler error in GCC's change_address_1
(Florian Fuchs)
- update various default configuration files of several boards to
[30 lines not shown]
[SelectionDAG] Lower direct inline asm inputs of aggregate type
SelectionDAG represents an aggregate as one value per member, but lowered
a direct inline asm input of aggregate type as if it were a single value.
A memory input crashed computing the store's type ("Unknown type!"), and a
register input, which ParseConstraints() gives the integer type of the
aggregate's size, passed only the first member: e.g. "r" of a { i32, i32 }
dropped the second i32, and of a [2 x i64] asserted in getCopyToParts().
Store the members to a stack slot, as visitStore() does, and pass the slot
to a memory input, or load the integer from it for a register input.
Fixes #235567.
Assisted-by: Claude Opus 5.5
Merge tag 'mips_7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux
Pull MIPS updates from Thomas Bogendoerfer:
"MM:
- fix huge TLB handling
OCTEON:
- correct register access for CN6xxxx SOCs
- provide DTs for platforms where U-Boot doesn't have a DT
Decstation:
- fix 64bit kernels
- build cleanups
Others:
- cleanups and fixes"
* tag 'mips_7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: (30 commits)
MIPS: octeon: Add detection of UBNT Edgeroute Lite devices
[20 lines not shown]
Merge tag 'x86-urgent-2026-10-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fix from Ingo Molnar:
- Mark CPUID function 0x23 as being indexed - which bug could break
VMs (Sean Christopherson)
* tag 'x86-urgent-2026-10-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/cpuid: Mark CPUID function 0x23 as being indexed
Merge tag 'timers-urgent-2026-10-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer fixes from Ingo Molnar:
- Clear timer_base::pending_map on CPU hot-unplug, that can
cause temporal timeout processing anomalous on the next
hot-replug (Liang Hao)
- Fix PID refcount leak in the posix-cpu-timers do_cpu_nanosleep()
signal path (Cen Zhang)
- Require (CAP_SYS_TIME) permission to set auxiliary clocks
via aux_clock_set() (Daehyeon Ko)
- Update offsets on sequence counter retry in
ktime_get_update_offsets_now() (Thomas Weißschuh)
* tag 'timers-urgent-2026-10-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
timekeeping: Update offsets on sequence counter retry in ktime_get_update_offsets_now()
[3 lines not shown]