[MachineOutliner] Track exposed uses by register units (#243597)
The MachineOutliner does not account for sub-registers when adding
implicit uses to the call to an outlined function. This produces
liveness information that the machine verifier rejects. Track the
defined register units while walking the outlined range, so that
implicit uses are added more accurately.
[SPIR-V] Rebuild pointer constant arms of an aggregate PHI or select (#236370)
A constant arm's pointer members carry the pointee types deduced for
them anywhere in the module (constant expressions are shared between
functions), so the constant can be a different SPIR-V type than the PHI
or select and its other arms: `selectSelect` asserts. Rebuild such an
arm with `insertvalue`, which casts each member to the result's member
type.
Assisted-by: Claude Opus 5.5
---------
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[SPIR-V] Expose every aggregate extractvalue as a value-id (#236368)
An aggregate `spv_extractv` was exposed as an `i32` value-id only when
it fed an `insertvalue`. Afterwards it was retyped when it fed a return
or a call whose signature `SPIRVPrepareFunctions` had rewritten. An
aggregate PHI, select or freeze is always a value-id, so an extract
feeding one of those had a mismatched type. Expose every aggregate
extract as a value-id, whatever its users. Also assign its composite
type, which a PHI, select or freeze does not pass down to it. This makes
the return and callsite retyping unneeded, so it is removed.
An aggregate value-id reaching inline asm crashed type propagation in
`SPIRVPreLegalizer` (`getScalarOrVectorBitWidth` on the struct). Any
aggregate value-id can hit this, not only an extracted one, so
`propagateSPIRVType` no longer propagates an aggregate type through an
extend.
Assisted-by: Claude Opus 5.5
[2 lines not shown]
[SPIR-V] Serialize vreg types in MIR (#243863)
Drop the reservedRegsFrozen() check in finalizeLowering because
MIRParser freezes reserved regs before any pass runs
Another step toward SPIR-V MIR round trip
[AArch64][NFC] Add [de]interleave6 tests
interleave6 and deinterleave6 already have support for custom lowering
using st3/ld3 and uzp/zip, but was missing test coverage for a sequence
where values are interleaved and stored, or loaded and deinterleaved.
Assisted-by: Codex
[AArch64] Enable Custom Lowering of [de]interleave8
To enable lowering of [de]interleave8 intrinsics, we can
use the custom lowering for Factors of 4, as these are split
into intrinsics where native support is available for the relevant
ld/st instructions on AArch64.
Previously an operation where a store follows an interleave, or a
deinterleave follows a load, this would have been lowered to scalar
ldr and str instructions, instead, ld4/st4 is used reducing the number
of uzp or zip instructions needed to complete the sequence.
Assisted-by: Codex (tests)
Linux: Don't wake kswapd for larger spl_kvmalloc() attempts
When the ARC holds most of memory, which compaction can't move,
kswapd can make big contiguous blocks only by evicting a large part
of the ARC. The amount grows exponentially with the order, while
the vmalloc fallback would succeed anyway at a much lower cost.
Newer kernels' vmalloc() also first tries high orders, waking
kswapd the same way.
For KM_SLEEP allocations whose order is above the midpoint between
PAGE_ALLOC_COSTLY_ORDER and spl_kmem_alloc_max, clear
__GFP_KSWAPD_RECLAIM for both the physical attempt and vmalloc().
Direct reclaim is kept, so allocations can't fail where they did
not before, and retries after a failure wake kswapd as usual.
To keep kswapd waking at the low watermark for the order-0 pages,
allocate and free one order-0 page that may wake it before such
requests.
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
[2 lines not shown]
[AArch64][NFC] Add [de]interleave6 tests
interleave6 and deinterleave6 already have support for custom lowering
using st3/ld3 and uzp/zip, but was missing test coverage for a sequence
where values are interleaved and stored, or loaded and deinterleaved.
Assisted-by: Codex
[DebugInfo][FLMD] Add printing support for FLDebugLoc+DIDbgLoc
This patch follows up on the preceding patch by adding support for
printing FLDebugLoc as an attachment `!!dbgLoc(...)` for instructions and
debug records, and for printing DIDbgLoc nodes which contain a !!dbgLoc
operand.
A major component of this patch is the addition of a "DebugLoc conversion"
layer, which allows for conversion between DILocation and FLDebugLoc
formats. This is currently only used for converting DILocation->FLDebugLoc
for printing, but provides a common mechanism that will later be used for
FLDebugLoc<->DILocation conversion for printing+parsing, switching between
the two depending on which format is currently being used in-memory. Due to
the constraint of needing to support consistent conversions at different
points in time (primarily for MIR printing and lazy bitcode
materialization), some information is stored in the LLVMContext, including
a third representation of source location information, stored in a format
which is easy to convert to/from either existing format.
[11 lines not shown]
[FLMD][DebugInfo] Add classes for function-local DebugLocs
This patch adds two new classes. The first, FLDebugLoc, represents a
DebugLoc in a function-local context; combined with the correct
`!MDFunctionLocalContext`, this class is equivalent in information to a
`!DILocation`, with some exceptions (IsImplicitCode is not included,
IRLayers are to-be-implemented). The second, DIDbgLoc, is a new
MDNode type which wraps an `MDFunctionLocalContext*` and an `FLDebugLoc`.
This makes it an effective substitute for `DILocation` in metadata,
able to replicate the interface of `DILocation` entirely. Implementation
of this interface is added in a later patch.
Add MDFunctionLocalContext support to update_test_checks
The new `!MDFunctionLocalContext` metadata type is unique in that it may
be printed across multiple lines, which causes the update_test_checks
script to only generate checks, and transitively find other metadata, for
the opening line. This patch fixes this by recording multiple lines for
metadata, where the first line ends with '[' and the last line ends with
'])', matching the printed format of `!MDFunctionLocalContext`.
[DebugInfo][FLMD] Add bitcode printing/parsing for function context
This patch adds support for bitcode printing/parsing for
MDFunctionLocalContext. This is an unusual entry in that it contains
multiple variable-length arrays, and collectively comprises a potentially
very large (technically up to ~2^32, realistically >10000 is possible)
number of records. There is no abbreviation, since the existing
abbreviation mechanism does not easily translate to this case.
Also unique is that, as with the LLParser, we use a custom forward
reference resolution. In this case, we track the metadata IDs rather than
maintaining a TrackingMDRef, and resolve these at the general metadata
resolution step, where the MetadataList has been finalized.
netipsec: Copy the offload interface name to a cloned SA
When SADB_UPDATE changes the addresses of an SA, key_updateaddresses()
replaces the SA with a clone. For an SA that names an offload interface
it allocated a buffer for the clone's copy of the name, and then called
strncpy() with the arguments swapped. The clone was left with an
uninitialized name, and the name of the old SA was overwritten with the
contents of the new buffer.
Copy the name from the old SA to the new one.
Also, the clone starts as a bcopy() of the old SA, so its natt and
accel_ifname pointers refer to memory owned by the old SA until they are
replaced. If one of the offload allocations failed, the error path freed
that memory, and key_cleansav() freed it again with the last reference
to the old SA. Clear both pointers right after the copy.
Reported by: llm-postcr
Reviewed by: kib
[4 lines not shown]
[DebugInfo][FLMD] Implement IR Printing/Parsing for FLMD context + nodes
This patch adds support for printing and parsing textual IR for the
MDFunctionLocalMetadata class and each of the MDNode classes, FLScope,
FLSrcLoc, and FLInlinedCall.
The display logic goes beyond that of typical MDNodes, primarily in that
the FLMD storage arrays are printed with each element on a separate line.
A flag is added that prints everything on a single line, which is
recommended for some machine-parsing cases, but not recommended for either
human-reading or testing, where one-entry-per-line aids clarity.
This patch does not yet add support for the update_test_checks, since that
involves some non-trivial work worthy of a separate commit.