[LoopVersioning] Register cloned assumptions with the AssumptionCache (#247080)
LoopVersioning clones the loop, including llvm.assume calls, but did not
register the clones with the AssumptionCache. The cache is never
invalidated, so after versioning it was missing the assumptions of the
non-versioned loop for the rest of the pipeline.
Take the cache from the LoopAccessInfo, which every user already passes
in. This fixes all users at once: LoopLoadElimination, LoopDistribute,
LoopVersioningLICM, LoopFlatten and the loop-versioning pass.
Follow-up to #245493.
[RISCV][Docs] Document argument alignment for LP64E (#246955)
The E ABI note gives only the ILP32E stack alignment. Document the
8-byte alignment for LP64E and the register-passing rule for wide
variadic arguments. LLVM 24 adopted this behavior for `__int128` in
#239884.
Clang 24 and GCC 15.2 both passed a double-width variadic integer in
`a1` and `a2` after one named integer argument. With the argument
registers exhausted and one word already on the stack, the value started
at `4(sp)` for ILP32E and `8(sp)` for LP64E.
The 10 RUN lines in the ILP32E and LP64E `calling-conv` and `vararg`
tests passed. The edited guide built with Sphinx warnings treated as
errors.
Assisted-by: OpenAI Codex
[Mips] Fix MSA performORCombine folding a select with a constant arm (#246218)
performORCombine set IsConstantMask whenever Op0Op0 or Op0Op1 was a
constant splat, even if its inverse was not found. If the pattern was
then matched by the non-constant search, the stale Mask was used to
fold the degenerate cases, so (c ? splat(-1) : x) was folded to the
all-ones arm and the select was dropped.
Only treat the mask as constant when its inverse was actually found.
Fixes #244166
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
cpufreq_dt: Do not use an uninitialised OPP when restoring the state
cpufreq_dt_set() only looks up the current OPP (copp) when the voltage
cannot be read from the regulator. When it can, which is the usual
case, copp is never set but the two error paths that restore the
previous state still use it: a failure to set the clock reads the
voltage limits of copp and a failure to lower the voltage reads its
frequency.
Restore the frequency with the one that was read from the clock before
the change, and look up the current OPP when the voltage has to be
restored, skipping it if there is none.
Fixes: a701764e9c50 ("Improve cpufreq_dt.")
Reported by: llm-postcr
cpufreq_dt: Use all the OPPs when the hardware version is unknown
An OPP with opp-supported-hw is only used if the hardware version, given
by the vendor specific code, matches it. When no vendor class handles
the OPP table, for example the ones of the TI and i.MX SoCs, the version
is unknown, so every OPP that has the property was dropped and the table
ended up empty. The driver still attached and cpufreq_dt_find_opp()
returned a pointer to an entry that does not exist, using an
uninitialised index.
Use all the OPPs when the hardware version is unknown, as if the
property was not there, which is what the driver did before the
property was honored. Also make cpufreq_dt_find_opp() return NULL for
an empty table, as its callers already expect.
Fixes: 7178a47a4ffd ("cpufreq_dt: Honor opp-supported-hw and opp-microvolt-<name>")
Reported by: llm-postcr
[MemoryBuiltins] Clean up strdup handling (NFCI) (#246693)
Now that strdup/strndup are the only allocators that still need special
handling, remove unnecessary genericity from the code.
We only need to actually handle strdup/strndup in one place, which is
getAllocSize(), so keep things local to that code.
[asan] Describe the reported address if a range runs past a freed chunk (#243938)
If an access starts inside a heap chunk and runs past its end, the
report describes the byte after the chunk. That is normally the first
bad byte in a live chunk. In a freed chunk the first byte of the access
is already bad, so describe that one. For `p = malloc(40); free(p);
memcpy(dst, p + 8, 41);`:
```
ERROR: AddressSanitizer: heap-use-after-free on address 0x...18
before: 0x...38 is located 0 bytes after 40-byte region [0x...10,0x...38)
after: 0x...18 is located 8 bytes inside of 40-byte region [0x...10,0x...38)
```
Reports about live chunks do not change.
Assisted-by: Claude. I have reviewed every line of this PR.
18821 loader: tftp recvtftp() should read the error code once
Reviewed by: Andy Fiddaman <illumos at fiddaman.net>
Reviewed by: Sebastian Wiedenroth <wiedi at frubar.net>
Approved by: Gordon Ross <gordon.w.ross at gmail.com>
Stop send-keys rejecting pane input when the default target client is
readonly by checking the client that ran the command. Based on fix from
Karl Lehenbauer in GitHub issue 5940.
[LoongArch] Lower i128 atomicrmw to a single LL.D/SC.Q loop
i128 xchg/add/sub/and/or/xor/nand were expanded by AtomicExpand to an
atomic load plus a cmpxchg loop nested in an outer retry loop. Lower them
instead to pseudo instructions that are expanded after register allocation
into one loop computing the new value between LL.D/LD.D and SC.Q, like
GCC:
.loop:
ll.d lo, addr, 0
dbar 20
ld.d hi, addr, 8
<op> new_lo, new_hi, lo, hi, val_lo, val_hi
sc.q new_lo, new_hi, addr
beqz new_lo, .loop
For nand the operand is inverted outside the loop and the loop uses ORN.
Other operations (min/max, uinc_wrap, ...) still use the cmpxchg loop.
[asan] Complete the report when a stack frame has no valid header (#243684)
If a stack frame's magic number is missing, a CHECK fails while the
report is being prepared and the error itself is never printed:
```
CHECK failed: asan_thread.cpp "((ptr[0] == kCurrentStackFrameMagic)) != (0)"
```
Return "no frame found" instead, so the report completes and names the
thread whose stack holds the address. `__asan_locate_address` and
`__asan_describe_address` no longer die on such an address either.
Users hit this CHECK in google/sanitizers#1010, google/sanitizers#1531
and google/sanitizers#1669 (not reproduced).
Assisted-by: Claude. I have read every line of this PR.
[asan] Handle free-size-mismatch in __asan_get_report_dealloc_address (#243682)
`__asan_get_report_dealloc_address` returns 0 for free-size-mismatch
(`free_sized`, `free_aligned_sized`), so an `__asan_on_error` callback
or a debugger cannot get the address. Return the pointer and the size
that the caller passed, as for new-delete-type-mismatch.
Assisted-by: Claude. I have read every line of this PR.