[X86][APX] Test the relocation of an NF add
test_regclass_not_updated_by_regalloc_2 only produced an NDD/NF add
with a GOT operand because the allocator happened to give the add a
destination different from its source. With SlotIndexes compaction it
picks the same register, so the add is compressed to the legacy form
and the CODE_6 TODO lost its test.
Add a function whose add keeps its source live, so it stays NDD and
becomes NF under any allocation.
[X86] Enable SlotIndexes compaction by default
Compacting SlotIndexes before greedy allocation drops the entries of
erased instructions, so live range sizes and instruction distances
reflect the code being allocated rather than how much was erased
before it. AMDGPU has done this since #235806; do the same for X86.
Codegen changes only through allocation: no new crashes, verifier
errors or allocation failures in the lit suites, including
EXPENSIVE_CHECKS, and a stage-2 build of LLVM, clang and lld with
-verify-machineinstrs passes its own tests. On llvm-test-suite at -O3,
spills drop 0.3% and .text 0.06%, with compile time unchanged.
Most test updates are regenerated checks. misched-matmul now inserts
20 spills instead of 24. live-debug-vars-stale-slotindexes.mir gets
one more use of %27 so that accumulate_fit still reaches the stale
index path it was written for.
[CIR][SYCL] Emit sycl_in_device field to the for cir.lowering_options (#238117)
Add sycl_is_device field to the `cir.lowering_options`. This is
populated during CIRGen time from `langOpts.SYCLIsDevice`.
[lld] Add a fast path to lld::utils::getRootSymbol() (#240407)
StringRef::rsplit() calls StringRef::rfind(), which calls
string_view::rfind(), which is a naive reverse loop at least in libc++.
Most symbols don't contain `.` characters, so quickly check for that
(which uses an optimzied string search, which is much faster).
(We could instead revert 2f851f26ead0ea and move StringRef::rfind() back
to its own impl and then do something like 4d681d7dc49 / 233edd20a774bbc
to make it faster, but it seems there's a desire to make StringRef
*more* like string_view over time. And also, using that all args we pass
to it here contain a `.` is a real higher-level optimization.)
This code is hot in ld64.lld when using -order_file.
Reduces link time of a release static symbol_level=1 aarch64 Chromium
Framework link from 4.533 s ± 0.017 s to 4.252 s ± 0.045 s, a ~6%
reduction.
[3 lines not shown]
[SLP][AMDGPU][NFC] Add a test of FP chains in short blocks (#241014)
Chained complex multiplies in a short block, in a loop, after a loop and
across a branch, on gfx942. SLP keeps all of them scalar today.
[libc][test] Guard custom matchers with LIBC_TEST_HAS_MATCHERS() (#241062)
Commit 528affb94ef8 (#240616) updated ErrnoSetterMatcher and FPMatcher
to
inherit from Matcher<T> and accept MatchResultListener * without
guarding
the matcher definitions on LIBC_TEST_HAS_MATCHERS(). Downstream test
frameworks that do not support matchers (such as Fuchsia's zxtest and
Pigweed's light pw_unit_test) fail to compile headers that transitively
include FPMatcher.h for FPTest or DECLARE_SPECIAL_CONSTANTS (e.g.
stdfix/ExpTest.h) or include ErrnoSetterMatcher.h.
Guard the matcher classes, factory helpers, and EXPECT_THAT/ASSERT_THAT
macros in ErrnoSetterMatcher.h and FPMatcher.h with
LIBC_TEST_HAS_MATCHERS(), keeping FPTest, DECLARE_SPECIAL_CONSTANTS, and
non-matcher rounding helpers unconditionally available, and replace the
unused ErrnoSetterMatcher.h include in snprintf_test.cpp with direct
CPP/limits.h.
[2 lines not shown]
[ConstraintElim] Split signed min/max across their operands when checking a compare
The existing constraint systems only record the bounds that hold for both
operands of a min/max (smax(a, b) >= a and >= b, smin(a, b) <= a and <= b). The
other direction is a disjunction, which cannot be recorded as a fact. When a
compare of signed decompositions involves a min/max result, split it into its
operands: the decomposition is monotonic in that result, so it is the max or min
of its values on each side, and the relation holds for all or for either side
respectively.
https://alive2.llvm.org/ce/z/zsGkJ-
[ConstraintElim] Prove sadd/ssub.with.overflow cannot overflow from the exact sum
Decompose the operands and show that the sum lies in the range of the type. This
handles patterns like A + (B - A), as well as sums involving signed min/max
results, which are split across their respective operands using monotonicity
(for example start + smax(end - start - 1, 0) <= end).
https://alive2.llvm.org/ce/z/ze8LCk
[ConstraintElim] A signed sum of operands with opposite signs cannot wrap
If one operand is known non-negative and the other non-positive, the signed
sum is between them, so it cannot overflow.
https://alive2.llvm.org/ce/z/ZF5Yqr
[RuntimeLibcalls] Extend i32 libcall arguments and returns on VE (#240638)
clang adds `sign-/zeroext` attributes to `int`/`unsigned` for VE.
Libcalls synthesized by the compiler lacked the those attributes.
Assisted-by: Claude
[Hexagon] Add assembly mapping for LX_mux_h_alt (#241036)
Map the alternate conditional syntax to LX_mux_h while preserving the
operand order.
Co-authored-by: Alexey Karyakin <akaryaki at quicinc.com>
[MSP430] Fix the underlying type of wint_t (#240972)
This is a minor ABI change since the behavior can only be observed when
extending `wint_t` to a wider type.
[Xtensa][NFC] Fix immediate operand predicates (#235122)
Correct operator precedence in alignment checks and add the missing
four-byte alignment constraint to imm64n_4n.
These don't seem to be currently used by any selection pattern, so there
is no functional change.
[AMDGPU] Preserve exec copies across intervening EXEC writes (#238985)
`SIOptimizeExecMaskingPreRA` can replace a saved EXEC value with the
physical EXEC register even when EXEC is overwritten before the only
user. The user then reads the new mask instead of the saved one.
Scan from the copy to its user and reject the fold across any
intervening EXEC modification. The first commit precommits the current
behavior; the second applies the fix and updates the checks.
AI assisted with the analysis and development of the fix.
[Attributor][NFC] Get the associated value of a call site argument from its use (#240919)
For a call site argument, `getAssociatedValue` computed the operand
number from the use only to look the operand up again. Use the value of
the use directly.
CTMark with `-attributor-enable=light`: -0.19% (O3), -0.20% (ThinLTO).
Co-authored-by: Matt Arsenault <Matthew.Arsenault at amd.com>
Assisted-by: Claude Opus 5.5
[lldb] Make darwin-mte-launcher die from its program's signal (#239873)
When the program the launcher spawns is killed by a signal, the launcher
returns `WEXITSTATUS(status)`, which is 0. A crash under the launcher
then looks like a clean exit, so the shell and API tests that run lldb
through it can't tell that lldb crashed.
This patch makes the launcher re-raise the program's signal so callers
see the crash. It first restores the signal's default action and
unblocks it, since the launcher inherits both from its parent.
The program already had its chance to report the crash, so before
re-raising, we clear the launcher's `EXC_MASK_CRASH` and
`EXC_MASK_CORPSE_NOTIFY` exception ports to avoid a second crash report.
Clearing `EXC_MASK_CRASH` alone, as LLVM does for
`LLVM_DISABLE_CRASH_REPORT`, still lets the system write a report. We
only do this once the program has exited, because the program would
otherwise inherit the ports.
[2 lines not shown]
[RISCV] Use std::optional for riscv-max-build-ints-cost command line option (#240976)
This seems more sensible than giving a value of 0 a special meaning. A
explicit value of 0 will be treated as 2 now rather than using the load
latency.
[lldb] Recognize signal trampolines from CFI before unwind-plan selection (#237016)
Signal dispatch can install a return address at the first instruction of
a trampoline without a preceding call. If the trampoline is not
recognized by name, LLDB can back up that address into the preceding
function before finding its signal-frame CFI.
Extend trap-handler detection to consult .eh_frame as well as platform
and user-provided names. CFI-recognized handlers use the existing
trampoline-entry exception and trap-handler plan selection. Test
recognition without target.trap-handler-names, retain name-only
coverage, and check that a real call inside a signal-marked function
uses the call-site row when the return PC starts a terminal row.
Assisted-by: GPT