[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
[clang-repl] Pass the target features to the device TargetMachine (#235754)
IncrementalCUDADeviceParser creates the NVPTX TargetMachine with an
empty feature string. The +ptxNN feature that the driver derives from
the CUDA version is dropped, causing the backend to emit the minimum PTX
version for the target SM instead. A kernel using a newer instruction
then fails to load with cudaErrorInvalidPtx, for example shfl.sync below
sm_70.
Join TargetOptions::Features into the feature string, as done in
EmitAssemblyHelper::CreateTargetMachine.
Add a unittest that passes --cuda-feature=+ptx80 to the device
compilation and checks the .version of the embedded PTX.
[IR] Put validateInstrOrdering behind ABI_BREAKING_CHECKS (#235885)
A release LLVM library will provide no definition for
validateInstrOrdering, but the inline definition is guarded behing
NDEBUG -- so a LLVM consumer including the headers without NDEBUG won't
have a definition of the function (and is thereby prevented from calling
invalidateOrders()).
Move the inline function behind LLVM_ENABLE_ABI_BREAKING_CHECKS instead.
[lldb] Show a process picker in process attach without a pid
This patch makes `process attach` show an `IOHandlerPicker` listing the
processes on the selected platform, with their pid, name, and
architecture, when it is run without a pid or process name and the target
has no executable to fall back on. `platform process attach` does the same
whenever no pid or name is given. Scripted process attaches (`-C`) are left
unchanged.
When the input is not an interactive terminal, both commands skip the
picker and fail the same way they did before, and canceling the picker
fails with "no process selected".
Assisted-by: Claude
Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>
[lldb] Add search to IOHandlerPicker
This patch lets the user filter the picker's rows by pressing `/` and
typing a query. A row is shown if any of its columns contains the query,
ignoring case. While the search prompt is open, printable keys edit the
query and the arrow keys keep moving through the matches. Enter applies
the filter and returns to navigation, ESC clears it, and Backspace on an
empty query leaves the prompt.
The footer shows the active filter and how many rows it hides. In
multi-select mode, rows hidden by the filter keep their checked state and
are still returned on confirm.
To support this, `ReadKey` now returns printable characters as-is, and the
mapping of `j`, `k`, `s`, and Space to actions moves into `HandleKey`. A
read failure or Ctrl+C always cancels the picker, even while searching.
Assisted-by: Claude
Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>
[2 lines not shown]
[lldb] Add column sorting to IOHandlerPicker
This patch lets the user sort the picker's rows by pressing `s`, which
cycles through each column in ascending then descending order before
returning to the original order. A column whose values are all integers
compares numerically, and other columns compare as strings. Ties keep
their original relative order, and the cursor moves back to the top after
each sort so the new order is visible.
The column header shows which column is sorted and in which direction, and
each column reserves room for that indicator so it doesn't shift the
layout.
Assisted-by: Claude
Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>
[lldb] Add an interactive picker IOHandler
This patch adds `IOHandlerPicker`, an ANSI-based IOHandler that lets the
user choose one or more items from a table. It supports single-select and
multi-select modes, arrow and vim-style navigation, and paging. It draws on
the alternate screen buffer so the user's scrollback is restored on exit,
redraws itself when the terminal is resized, and reports a canceled result
when the input is not an interactive terminal.
The statusline can't stay up underneath the picker: its scroll region
also applies to the alternate screen, and its cursor save/restore shares
the slot that leaving the alternate screen restores. This patch
addresses that by adding `Debugger::HideStatusline` and
`Debugger::ShowStatusline`, which the picker uses to remove the
statusline while it owns the screen and bring it back once it's done.
`AnsiTerminal.h` didn't have macros for the DEC private modes the picker
toggles: cursor visibility, auto-wrap, and the alternate screen buffer.
This patch adds them there, so we don't hard-code those escape sequences
[10 lines not shown]
[lldb] Show a process picker in process attach without a pid
This patch makes `process attach` show an `IOHandlerPicker` listing the
processes on the selected platform, with their pid, name, and
architecture, when it is run without a pid or process name and the target
has no executable to fall back on. `platform process attach` does the same
whenever no pid or name is given. Scripted process attaches (`-C`) are left
unchanged.
When the input is not an interactive terminal, both commands skip the
picker and fail the same way they did before, and canceling the picker
fails with "no process selected".
Assisted-by: Claude
Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>
[lldb] Add search to IOHandlerPicker
This patch lets the user filter the picker's rows by pressing `/` and
typing a query. A row is shown if any of its columns contains the query,
ignoring case. While the search prompt is open, printable keys edit the
query and the arrow keys keep moving through the matches. Enter applies
the filter and returns to navigation, ESC clears it, and Backspace on an
empty query leaves the prompt.
The footer shows the active filter and how many rows it hides. In
multi-select mode, rows hidden by the filter keep their checked state and
are still returned on confirm.
To support this, `ReadKey` now returns printable characters as-is, and the
mapping of `j`, `k`, `s`, and Space to actions moves into `HandleKey`. A
read failure or Ctrl+C always cancels the picker, even while searching.
Assisted-by: Claude
Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>
[lldb] Add column sorting to IOHandlerPicker
This patch lets the user sort the picker's rows by pressing `s`, which
cycles through each column in ascending then descending order before
returning to the original order. Columns marked `is_numeric` compare as
integers, and other columns compare as strings. Ties keep their original
relative order, and the cursor moves back to the top after each sort so the
new order is visible.
The column header shows which column is sorted and in which direction, and
each column reserves room for that indicator so it doesn't shift the
layout.
Assisted-by: Claude
Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>
[lldb] Add an interactive picker IOHandler
This patch adds `IOHandlerPicker`, an ANSI-based IOHandler that lets the
user choose one or more items from a table. It supports single-select and
multi-select modes, arrow and vim-style navigation, and paging. It draws on
the alternate screen buffer so the user's scrollback is restored on exit,
redraws itself when the terminal is resized, and reports a canceled result
when the input is not an interactive terminal.
The statusline can't stay up underneath the picker: its scroll region
also applies to the alternate screen, and its cursor save/restore shares
the slot that leaving the alternate screen restores. This patch
addresses that by adding `Debugger::HideStatusline` and
`Debugger::ShowStatusline`, which the picker uses to remove the
statusline while it owns the screen and bring it back once it's done.
`AnsiTerminal.h` didn't have macros for the DEC private modes the picker
toggles: cursor visibility, auto-wrap, and the alternate screen buffer.
This patch adds them there, so we don't hard-code those escape sequences
[9 lines not shown]
[BOLT][Docs] Update webpage styling (#237235)
This PR makes a variety of changes, ahead of the new BOLT sub-domain to
improve the formatting of the webpages:
- Added HTML/CSS styling and templates inspired by
https://clang.llvm.org/.
- Makes navigation, labelling and spacing consistent
- Simplifies the Sphinx configuration to build the webpages.
- Added documentation on how to edit the webpages.
Additionally this PR links to
[#1070](https://github.com/llvm/llvm-zorg/pull/1070) which enables the
webpages to be built using Sphinx.
Assisted-by: Codex
[SPARC] Add live-ins for reserved registers remapped in leaf procedures (#236654)
Leaf procedure lowering remaps %i0-%i7 to %o0-%o7 after register
allocation. Reserved registers are not tracked by liveness, so a read of
%i7 through llvm.read_register has no live-in. Once %i7 is remapped to
the unreserved %o7, the machine verifier reports a use of an undefined
physical register. The test added by PR 212838 reads %i7 as %r31 and
hit this on the expensive checks builders.
When a reserved %i register is remapped to an unreserved %o register,
add the %o register as a live-in to every block. In a leaf procedure it
holds the incoming value for the whole function.
PR 213359 instead moved the leaf decision before register allocation.
That made call-free functions under register pressure into leaf
procedures that spill instead of keeping their register window. Here
the leaf decision stays after register allocation.
leafproc-high-pressure.ll is the test doac provided in the review of
[7 lines not shown]