[AMDGPU] Check register class when folding a redundant AND (#217900)
tryFoldRedundantAND accepts an SALU AND as the parent instruction. The
child
AND can be a VALU instruction, so the fold replaced a VGPR with an SGPR
in
every use of the child result. A use that requires a VGPR, for example
data0
of DS_BPERMUTE_B32, then fails the machine verifier. This aborted a
rocPRIM
build for gfx1010.
Call constrainRegClass on the replacement register with the register
class of
the folded register, and fold only when it succeeds. Every use of the
folded
register accepts its register class, so the constrained replacement
register
is legal in those uses, and no walk over the uses is needed.
[11 lines not shown]
[SPIRV] Pass optLevel to InstructionSelect
Canonical with all other targets (minus m68k which I will fix next).
Seems to have been dropped in eab7d3639b3c6dc9dda9a0ab1643f0e45ad2d9d6
accidentally when introducing the InstructionSelect subclass to avoid
the need for RegBankSelect.
Reviewers: Keenuts, arsenm
Pull Request: https://github.com/llvm/llvm-project/pull/217929
[GISel] Remove SPIRVInstructionSelect
This subclass only existed to remove the need for MFs to have the
RegBankSelected property coming into InstructionSelect. The NewPM plays
much less nicely with pass inheritance, so change this to an option
specified as a parameter in the InstructionSelect constructor to avoid
inheritance so the future NewPM port can have the ~same API for
creation.
The usage of CodeGenOptLevel::Default matches the existing behavior,
although is probably wrong. That should be fixed in a separate patch
though.
Reviewers: arsenm, Keenuts
Pull Request: https://github.com/llvm/llvm-project/pull/217928
[RISCV][MC] Add experimental Smip, and Ssip support (#215095)
Add support for version 0.20 of the Smip, and Ssip extensions from the
RISC-V fast interrupt specification. Also bump the existing extensions
of ACLIC to 0.20.
[PeepholeOpt] Erase optimized compare from LocalMIs earlier (#217848)
We need to drop the compare instruction that was optimized away from
LocalMIs before the LocalMIs-based load folding optimization a few lines
below. Addresses a regression from #194662.
Fixes https://github.com/llvm/llvm-project/issues/208746.
---------
Co-authored-by: woruyu <1214539920 at qq.com>
(cherry picked from commit b26a359753175bd5cc53fb0f2a168d12bb0498c8)
[MIPS] Don't mark SLL64_64 as isMoveReg (#214060)
I was running into a Rust miscompilation using pretty standard code (see
bugreport). I had Claude rootcause this to an LLVM bug, where SLL (on 64
bit) is marked as "move", even though it isn't - for full 64-bit values
(with arbitrary upper 32 bits), SLL is not a move as the upper bits get
just sign extended.
The fix itself is tiny and makes sense to me (I know MIPS very well, but
have little LLVM expertise myself). The test for this however is pretty
convoluted as it is quite hard to trigger this bug reliably - it needs
quite some register pressure to actually happen.
On the llvm/test/CodeGen/Mips/madd-msub.ll change: Register indices
changed here as the is the register allocator is now picking a new
independent register instead of reusing an existing one (`sll $4, $4, 0`
changes to `sll $1, $4, 0`). In this particular example that causes
instruction counts to be the same, though in other examples a small
increase is possible (cost of correctness).
[5 lines not shown]
[X86] isTargetShuffleEquivalent - only use "known zero" element if its known never poison/undef as well (#217030)
We're starting to hit cases where we've used AND/ANDNP masking to zero
out vector elements, but SimplifyDemandedElts assumes the element is
unused, folds to poison and then later folds AND(poison,0) -> poison.
This needs a more thorough cleanup of a number of x86 folds that do this
(similar to #215538), but that would result in a great deal of churn,
and it looks like a #214388 fix requires backporting to 23.x.
So initially I'm taking the approach that @xyyy1420 found so we can get
this backported and I can then address the issue more thoroughly in
trunk. I'm not convinced that this will address all poison cases, but
I'm reluctant to attempt a larger backport patch.
Fixes #214388
(cherry picked from commit 727136090b77a4c6840283758af4bceb8056dcfc)
[Support][test] Fix OpenDirectoryAsFileForRead test on AIX and z/OS (#216241)
Commit 9c7ba7b1d12e ("[AIX][SystemZ][Support] Check if file is dir on
open instead of read") moved the `fstat`/`EISDIR` check from
`readNativeFile()` to `openNativeFileForRead()` on AIX and z/OS. This
means `openNativeFileForRead()` now returns `EISDIR` immediately on
those
platforms, but the test `FileSystemTest.OpenDirectoryAsFileForRead` was
not updated to match, causing it to fail at the
`ASSERT_THAT_EXPECTED(FD, Succeeded())` assertion.
Add a `#elif defined(_AIX) || defined(__MVS__)` branch to the test that
expects the error to be returned from `openNativeFileForRead()` rather
than from `readNativeFile()`, consistent with the behavior introduced by
that commit.
(cherry picked from commit 828d2d7fb65a9cd5946b347ad5173e3bdb21387d)
18292 nfs assert panic in rw_exit with concurrent lock and open
Reviewed by: Jason King <jason.brian.king+illumos at gmail.com>
Reviewed by: Matt Barden <mbarden at racktopsystems.com>
Reviewed by: Paul Zuchowski <p.zuchowski98 at gmail.com>
Reviewed by: Gordon Ross <gordon.w.ross at gmail.com>
Reviewed by: Roland Mainz <roland.mainz at nrubsig.org>
Approved by: Robert Mustacchi <rm at fingolfin.org>
libarchive: Avoid collision with LIBARCHIVE variable in makefile.
It was both the path to the .a file for DPADD, and the path to the
source directory. Can't be both, and the source directory is purely
local while the .a file is used in other makefiles, so let's call the
source directory LIBARCHIVEDIR instead.
Found while trying to diagnose:
PR lib/60560: libarchive tests are failing
[llvm-objcopy] Stream ELF output to regular files
Write ELF output directly to seekable regular files instead of first allocating a buffer for the entire output. Keep buffered output for stdout and other non-seekable streams.
Use separate buffered and file-backed output implementations. Serialize regenerated metadata sequentially, seeking once per output range, and report sticky file errors after writing finishes. Truncate and extend seekable output up front so unwritten layout gaps read as zero without being materialized; explicitly overwrite only removed section contents within copied segments.
On a synthetic stamping-style ELF containing a 1 GiB payload, three warm-cache no-op copies had median peak RSS of 2,102,916 KiB before and 1,053,844 KiB after (49.9% lower). Median wall time improved from 1.06 s to 0.77 s, and the outputs were byte-identical.
Co-authored-by: Jeremy Braun <jtbraun at meta.com>
Assisted-by: OpenAI Codex
sysutils/freebsd-rustdate: fix the build on RISCV
Patch the port to use a newer version of libc, allowing it to work on
RISCV systems without COMPAT11.
PR: 296820
Sponsored by: ConnectWise
Approved by: fullermd at over-yonder.net (maintainer timeout)
[WebAssembly] Implement support for Common symbols (#199303)
This patch adds end-to-end support for common symbols (`.comm` /
`-fcommon`)
for the WebAssembly target in LLVM and LLD.
1. Object File and binary format:
- Introduce the `WASM_SYMBOL_BINDING_COMMON` (0x40) symbol flag in
`Wasm.h`.
- Update `WasmObjectWriter` and `WasmObjectFile` to serialize and parse
common
symbol metadata (size and alignment) in the linking symbol table.
- Update YAML tooling and `llvm-readobj` to handle common symbols.
2. LLD Support:
- Introduce `CommonSymbol` representing common data symbols.
- Implement common symbol resolution in `SymbolTable::addCommon`:
- Multiple common symbols are merged by selecting the maximum size and
alignment.
- Strong defined symbols override common symbols.
[12 lines not shown]