[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] Remove `noexcept` from ABIInfo destructor (NFC) (#235779)
This NFC removes `noexcept` from the `ABIInfo` destructor in order to
suppress this compilation warning:
```sh
[1/10] Building CXX object tools/clang/lib/CIR/CodeGen/CMakeFiles/obj.clangCIR.dir/TargetInfo.cpp.o
/Users/federicobruzzone/dev/llvm-project/clang/lib/CIR/CodeGen/TargetInfo.cpp:177:10: warning: function previously declared with an implicit exception specification redeclared with an explicit exception specification [-Wimplicit-exception-spec-mismatch]
177 | ABIInfo::~ABIInfo() noexcept = default;
| ^
/Users/federicobruzzone/dev/llvm-project/clang/lib/CIR/CodeGen/ABIInfo.h:25:11: note: previous declaration is here
25 | virtual ~ABIInfo();
| ^
1 warning generated.
```
Signed-off-by: Federico Bruzzone <federico.bruzzone.i at gmail.com>
[GlobalISel] Don't constrain register classes of debug operands (#228078)
D129037 made the AArch64 and X86 selectors constrain every vreg operand
of a debug instruction to the smallest register class for its bank. The
case it targeted was a `DBG_VALUE` left referring to an erased def: the
vreg had no class after selection, and a later `getRegClass` call
crashed.
The constraint also applies to vregs with real defs and uses. A debug
instruction is selected before the def of its operand, so the operand
already has the smallest class when its def is selected, even if the def
would give it a wider class without debug info. In #227628, a `COPY`
destination gets `gpr64` instead of `gpr64all`, so the `COPY` is no
longer removed as redundant and the `-O0` code changes.
#231716 fixed the erased-def case at its source: `salvageDebugInfo` now
sets unsalvageable debug uses to `$noreg`.
This PR removes `selectDebugInstr` from both selectors. Vregs with
[7 lines not shown]
[ARM] Fold away buildvector(buildvector) (#235524)
This folds away ARMISD::BUILD_VECTOR of another BUILD_VECTOR, generating
a new operation with the operand values directly.
This fixes #234135 from seeing verifier errors by avoiding the undef
lanes.
[ADT] Qualify AddressRange in AddressRangesBase::find. NFC (#237144)
With `-fdelayed-template-parsing` (the default for clang targeting the
MSVC ABI), `find` is parsed at the end of the TU, where `llvm-profgen`
makes `llvm::sampleprof::AddressRange` visible in `namespace llvm`.
Qualify with `llvm::` to avoid the ambiguity.
```
AddressRanges.h:101:42: error: reference to 'AddressRange' is ambiguous
note: candidate found by name lookup is 'llvm::AddressRange'
note: candidate found by name lookup is 'llvm::sampleprof::AddressRange'
```
[SPARC] Keep the GOT memory operand on TLS initial-exec loads (#237512)
The initial-exec TP offset load (SPISD::TLS_LD) was a plain node, so
TLS_LD[X]rr had no memory operand and was not known to be an invariant
load. MachineLICM, MachineCSE and rematerialization then left one GOT
load per use, including inside loops.
Build it as a memory node with a GOT MachinePointerInfo, as was done for
the GOTDATA_OP load in 5cf27304eccf.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[DirectX] expandIsFPClass - silence MSVC promoted shift warning (#237237)
Use APInt::getSignMask to create -0.0 bitmask instead of raw uint32_t
shift that is then implicitly promoted to uint64_t in the
ConstantInt::get call.
Silences MSVC "result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)" warning.
[libc][stdlib] Avoid scanning values during environment lookup (#228633)
Constructing a string_view for each environment entry scans the entire
value to determine its length, even when the name does not match. This
makes lookups unnecessarily expensive for long values such as PATH.
Filter entries by their first character, then compare the remaining name
up to a mismatch or null terminator. Require a following '=' to match
the complete key, preserving support for empty names in putenv.
Closes #196016