[PowerPC] Enable SlotIndexes compaction by default
Greedy measures live ranges in slot indexes, and instructions erased
before allocation (by PHI elimination, two-address lowering and the
coalescer) leave entries behind that make ranges look longer than
they are. Opt PowerPC in to dropping them, as AMDGPU and ARM do, so
allocation works with real distances. Passing
-greedy-compact-slot-indexes=false restores the old behaviour.
On CTMark (pwr8, pwr10, AIX, ppc32), .text and llc compile time move
by less than 0.03% and evictions drop by 1.5-5.8%.
The test updates are register allocation changes; csr-split.ll gets
back the live range split it was written to check.
[compiler-rt] Add Region-Encoded AddressSanitizer runtime
Host and device runtime for reasan, built on the sanitizer_common offload
layer. The common layer gains the HSA pieces reasan needs: pool and agent
queries, virtual memory reservation and sharing, code object enumeration,
cache publication, and device symbolization. The runtime keeps the
allocator, global aliasing, and report formatting. Each device begins on
its own metadata granule, so an entry load stays on the device that owns
the object.
The runtime follows ubsan's offload shape: HSA interceptors that report HSA
as absent when it is not loaded, a reasan-preinit archive, static and shared
runtimes, a receive-only RPC handler on SANITIZER_OFFLOAD_REASAN, and lit
tests on the common GPU substitutions. The report handlers elect the first
active lane, which is the first failing one, and take their return address
as the location of the access. Host checks call __reasan_report_load and
__reasan_report_store and take the caller's frame.
Fine-grain pools are placed only when the AMD extension honors pool flags
[5 lines not shown]
[Clang] Add -fsanitize=readdress for Region-Encoded AddressSanitizer
Wire the sanitizer through the driver, codegen, and preprocessor. Emit
sanitize_region_encoded_address, run the reasan pass, and link the reasan runtime
on AMDGPU offload and supported Linux hosts.
RFC: https://discourse.llvm.org/t/rfc-add-a-device-address-sanitizer-for-gpus-dasan/92710
[LLVM] Add RegionEncodedAddressSanitizer instrumentation pass
Instrument loads, stores, and memory intrinsics against reasan's
size-class metadata. The handler locates the access by its return
address, so each check calls a report of its own that is never merged,
inlined, or tail called. On AMDGPU, keep the dispatch pointer that
shared memory checks read, and preserve the __reasan_ entry points.
AMDGPU keeps one decode per inbounds root and selects the zero word for
an outside pointer, so the load can be hoisted and the wave does not
branch. Elsewhere an outside pointer is the common case, so membership
is a branch and the decode is its cold side. Global relocation defaults
to AMDGPU and follows -reasan-instrument-globals when set. The metadata
pointer uses the data layout's default globals address space.
RFC: https://discourse.llvm.org/t/rfc-add-a-device-address-sanitizer-for-gpus-dasan/92710
[IR] Add sanitize_region_encoded_address function attribute
Mark functions that should receive Region-Encoded AddressSanitizer checks,
matching the other sanitize_* attributes. Bitcode, LangRef, editor
syntax, and inliner compatibility rules are updated accordingly.
Speculative loads, non-local GVN load elimination, and hot/cold
splitting are suppressed under it, as they are for sanitize_address.
RFC: https://discourse.llvm.org/t/rfc-add-a-device-address-sanitizer-for-gpus-dasan/92710
BPF: Reject the address of a block of another function (#243914)
This was looking up every block address in a map of blocks of the
function using it, which asserted for a block of another function. A
jump to it from the owning function is defined, but gotox only jumps
to an entry in a jump table of its own function. Report it as
unsupported, also for a private table of such blocks.
A table with entries other than block addresses is loaded as data, so
check all of them before looking up any.
For now this leaves the broken IR modification in the AsmPrinter, but
that should really be removed.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[AMDGPU] Don't treat tensor.load.to.lds as a clobber of global loads (#247451)
llvm/llvm-project#229728 removed the memory-effect restriction from the
tensor load/store intrinsics, so every `llvm.amdgcn.tensor.load.to.lds`
is now a possible write to any memory, and `isReallyAClobber` has no
exception for it. Uniform global loads after a TDM load lose
`amdgpu.noclobber` and select `global_load_b32` instead of `s_load_b32`.
**Fix**: a tensor load reads global memory and writes only LDS, so
isReallyAClobber now returns false for tensor.load.to.lds when the
queried load is from a global address space
(AMDGPU::isExtendedGlobalAddrSpace).
Likewise, `tensor.store.from.lds` reads LDS and writes only global
memory, so it no longer clobbers LDS loads. Flat loads, which may alias
either, are still treated as clobbered.
**Motivation:** paged attention. Before each TDM copy of a K/V tile, the
[12 lines not shown]
[BOLT] Fix BAT and basic-sample header parsing order (#248110)
When the `boltedcollection` and `no_lbr` profile headers are supplied in
that order (such as from a tool like `merge-fdata`), this causes BOLT to
mis-parse the profile headers as the code assumes that they are supplied
in the order `no_lbr` and `boltedcollection`. This patch enables either
order of the headers to be accepted by BOLT.
NOTE: This builds on #86501.
[InstCombine] Fix arg conflation in ComputeNumSignBits (#248139)
The routine InstCombiner::ComputeNumSignBits passes the Depth integer in
place of the UseInstInfo boolean to ComputeNumSignBits, which was
unflagged to date due to implicit conversion. Fix this.
Assisted-by: llm, for testing
[lld][MachO][NFC] Introduce SectionView for section-level predicates
Add a lightweight `SectionView` wrapper implicitly constructible from
either a `Section` or an `InputSection`, and convert all section-level
predicate functions (`isCodeSection`, `isCfStringSection`,
`isClassRefsSection`, `isSelRefsSection`, `isEhFrameSection`,
`isGccExceptTabSection`, `usesAuthGot`, and ICF's
`isFoldableIgnoringRelocatedBytes`) to accept `SectionView`.
This avoids duplicating `(const Section &)` / `(const InputSection *)`
overloads as we refactor loops over `InputSection`s (which are generally
grouped by their originating `Section`) to hoist or cache section-level
predicate results across consecutive subsections of the same `Section`.
Planned follow-up sites include:
- `foldIdenticalSections()`, which evaluates `isCfStringSection`,
`isClassRefsSection`, `isSelRefsSection`, `isCodeSection`,
`isFoldableIgnoringRelocatedBytes`, and `isEhFrameSection` on every
subsection in `inputSections`:
[16 lines not shown]
[flang-rt] Fix undetected runtime error for direct-access read of an unwritten record (#246109)
Issue 193434 reports that reading an undefined record in a direct access
file silently succeeds.
Problem was `unit.cpp` was reporting the error condition as an
end-of-file, while it should have been reporting the error as an
end-of-direct-access-file (`IostatEndfileDirect,`).
Fixes https://github.com/llvm/llvm-project/issues/193434
[flang-rt] Fill return buffer for RTNAME(GetCwd) prior to copying the return string from libc's getcwd() (#245356)
`RTNAME(GetCwd)` does not blank fill the user's return buffer prior to
populating the buffer with the string returned from libc's `getcwd()`,
thus in most cases the Fortran string buffer has at least one NULL
terminator byte.
This is the second attempt at this PR taking into account the reviews
from the first go-around.
Fixes https://github.com/llvm/llvm-project/issues/223778
netinet6: Keep the AH flags on the inner packet of a tunnel mode SA
ip6_input() clears M_AUTHIPHDR and M_AUTHIPDGM on every packet. The
inner packet of a tunnel mode AH SA reaches it through netisr after
ipsec[46]_common_input_cb() has stripped the outer header, so it loses
the flags that ah_input_cb() set after verifying the ICV. The inbound
policy check in ipsec_in_reject() then finds no AH flag on a packet
whose policy requires AH and drops it as a policy violation ("inbound
packets violated process security policy" in netstat -sp ipsec6). With
the usual "require" level, every IPv6 packet carried by a policy-based
AH tunnel is dropped, whatever the outer address family. ESP is not
affected, since M_DECRYPTED is not cleared, and neither are IPv4 inner
packets, since ip_input() has never cleared the flags. if_ipsec(4) is
not involved, since it only uses ESP.
net.inet.ipsec.check_policy_history does not help: ipsec_in_reject()
checks the flags in addition to the history tags.
The clearing comes from KAME, whose ah6_input() deliberately did not
[24 lines not shown]