[LoongArch][NFC] Move XOR combine into performXORCombine
Extract the inline ISD::XOR handling in PerformDAGCombine into a
dedicated performXORCombine helper, matching how the other opcodes
(AND, OR, SETCC, ...) are structured. No functional change.
Also fix a clang-format issue in emitPseudoVMSKCOND.
Assisted-By: LLM
Revert "[DwarfDebug] Add applyDwarfVersion() so the targets like NVPTX can recompute the version-derived state" (#242150)
Reverts llvm/llvm-project#234510 as this PR introduce build breakage on
pre/post submit builders.
kernel - Work around forced umount race in nullfs
* Partial work-around for a umount race against a
call to statfs() through a null mount. Check
that mp->mnt_data is not NULL.
[DAGCombiner] Rebuild FMA chain instead of mutating it in place (#241188)
visitFADDForFMACombine folds
fadd (fma A, B, (fmul C, D)), E --> fma A, B, (fma C, D, E)
by replacing the inner fmul in place with ReplaceAllUsesOfValueWith.
If fma A, B, (fma C, D, E) already exists, e.g. when another expression
adds the same terms in a different order, CSE merges the updated chain
into it and the outer fadd becomes
fadd (fma A, B, (fma C, D, E)), E
The combine returns this outer fadd, retaining the extra addition of E.
If an identical fadd already exists, the outer fadd is CSE'd away while
being visited.
Rebuild the chain with getNode instead, and drop the DELETED_NODE check
in visitFADD.
[InferAddressSpaces] Infer constant addrspacecast operands
A cast back from the flat address space folds into a constant
expression when its operand is constant. Only AddrSpaceCastInst and
memory operands were visited, so such a cast used as a call argument
or a stored value kept its round trip through the flat address
space.
Visit constant expression operands of a specific address space.
Change-Id: Iab1aaaf809a41f48886d0412cdb96d756e5e86c5
Co-Authored-By: Claude Fable 5.2 <noreply at anthropic.com>
kernel - Work around forced umount race in nullfs
* Partial work-around for a umount race against a
call to statfs() through a null mount. Check
that mp->mnt_data is not NULL.
tests/sys/kern/ssl_sendfile: double timeouts for :grow and :truncate
The :grow and :truncate testcases fail semi-regularly in CI with
timeouts. Double the timeout to reduce false positives with the tests.
PR: 300699
MFC after: 1 week
Reviewed by: siva
Differential Revision: https://reviews.freebsd.org/D61444
asmc: include sys/kernel.h
This is needed for the `MODULE*` macros.
This include was accidentally removed in the linked commit.
MFC after: 1 week
Reported by: Ian Freislich <ianfreislich at gmail.com>
Fixes: c714cde179a4 ("asmc: split the sysctl layer into asmcsysctl.c")
[NFC][LowerTypeTests] Write export summaries to %t.out (#242134)
#221090 switched these tests from split-file to writing the summary to
%t. Incremental builds that ran the old tests still have %t as a
directory and fail with "Is a directory". Use %t.out so the tests work
in such builds, including incremental bisects across #221090.
Assisted-by: Gemini
iflib: Use a single tx dma map
The need for a separate map for TSO and non-TSO seems to have arisen from
a misunderstanding about the DMA requirements for Intel drivers like
ice/ixl/iavf. Specifically, this Intel hardware has a quirk where no
more than N (=8) segs can be DMA'ed per packet on the wire. This limit
was enforced using a DMA map with a low segment limit for non-TSO and a
driver specific check for TSO. This led to a *lot* of complexity in
iflib (~80 extra lines of code that this change removes) when the
limit can simply be enforced via the existing EFBIG mechanisms.
This change adds a new flag, IFLIB_SPARSE_TX, that drivers for hardware
with this quirk must set. When set, it causes non-TSO sends that
exceed isc_tx_nsegment to be treated as if bus_dmamap_load_mbuf_sg()
had returned EFBIG.
Due to the API/KABI change, I've bumped the FreeBSD version as well.
Note kgalazka suggested the flag, rather than a more awkward
[12 lines not shown]
[LoongArch] Select [X]VBITSELI_B for byte splat bitsel on wider element types
The VBITSELI_B/XVBITSELI_B patterns only matched v16i8/v32i8. When the
bitwise select idiom `(a & imm) | (~a & b)` appears on v8i16/v4i32/v2i64
(or the LASX equivalents) with a byte splat constant, e.g. from portable
SIMD implementations of the bitseli intrinsics, we emitted:
```
vrepli.b $vr2, 127
vbitsel.v $vr0, $vr1, $vr2, $vr0
```
Use vsplat_i8_uimm8, as VANDI_B/VORI_B/etc. already do, so that we now
emit:
```
vbitseli.b $vr0, $vr1, 127
```
Assisted-By: LLM
[LoongArch][NFC] Add tests for vector bitwise selection with byte splat immediates
Add tests for bitwise selection on non-i8 element vectors where the
select-constant is a byte splat, which could be selected to
VBITSELI_B/XVBITSELI_B.
Assisted-By: LLM
[asan] Scan fake stack allocation flags eight at a time (#242047)
After every noreturn call (throw, longjmp, ...) the next fake frame
allocation runs FakeStack::GC, which looks at the allocation flag of
every frame of every size class, one byte at a time: about 33,000 flags
for the default fake stack size. Usually few frames have their flag set,
so nearly all of that work is reading zeros.
Skip eight clear flags per load. LeakSanitizer's ForEachFakeFrame had a
copy of the loop; both now share ForEachAllocatedFrame. What is
collected and what is scanned for leaks does not change.
This helps programs that throw or longjmp often. libpng leaves every bad
input by longjmp: on x86_64 Linux, replaying a fuzzing corpus through
its read target takes 0.57 of the instructions and about 0.8 of the CPU
time. A plain longjmp or throw loop takes 0.3 to 0.9 of the time,
depending on the size of the frames, the depth and how long it has run.
The instruction count of 18 other workloads stays within 0.05%.
[7 lines not shown]
[Support] Vectorize the byte scan in StringRef::rfind(StringRef)
StringRef::rfind(StringRef) forwards to std::string_view::rfind. libstdc++
compares the whole needle with memcmp at every position; libc++ scans
backwards for the needle's last character one byte at a time. Neither is
vectorized, and there is no portable memrchr to call instead.
Scan backwards for the needle's first character 16 bytes at a time, with a
branch-free OR of compares per chunk that clang and GCC turn into one vector
compare and mask test, and compare the rest of the needle only where the
character occurs.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
Claude-Session: https://claude.ai/code/session_01TvfuMmXF8ywTFaZFX8JuGM
Reapply "[llvm-strings] Add --encoding={s,S,utf8} option (#221794)" (#241881)
This reverts commit 3a99f8bbe76805586c0247eba38b907bb8400dcb and fixes
the macOS iconv detection that prompted the original removal.
[Clang][CFI] Don't let -fdevirtualize-speculatively force llvm.type.checked.load (#241643)
9e7ce77573b2 (#159685) made `-fdevirtualize-speculatively` override both
conditions for emitting `llvm.type.checked.load`:
`-fwhole-program-vtables`
and hidden LTO visibility of the class. The override never helped
speculative devirtualization, because that pass only runs without LTO,
and CFI requires LTO.
With LTO and trapping `cfi-vcall`, the override adds a local CFI check
to
classes with public LTO visibility. That check only knows the vtables in
the current LTO unit, so it traps on valid objects created elsewhere,
such as `std::exception` subclasses from the shared C++ runtime or
classes from other DSOs. With `-fsanitize-cfi-cross-dso`, these calls
also skip `__cfi_slowpath`.
Remove the override.
[3 lines not shown]
snmp_hostres(3): strengthen work on the devd(8) socket
Use the SOCK_SEQPACKET version of the socket. This guarantees that
messages read won't be glued together. Use sufficient buffer size to
read any message.
Close socket on any kind of error or a short read.
This also fixes a bug when a SOCK_STREAM socket containing exactly
multiple of 512 bytes would block the daemon in read(2) until some
other devd(8) event. Thank to David for catching and analyzing it.
Reported by: David Pfitzner <dpfitzner at netflix.com>
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D61146
devd: expose maximum record size via sysconf(3)
Use UMA allocation size that holds the buffer. The buffer is actually
slightly smaller. Document the latter so that clients don't need to use
+1 if they later want to NUL-terminate a message.
Reviewed by: mjg, imp
Differential Revision: https://reviews.freebsd.org/D61346