[SandboxVec][LoadStoreVec] Fix pass return value (#245693)
Failed attempts at vectorization may still modify the IR even if no
vector instructions were emitted, because of scheduling. So in that case
we are currently returning false even though the IR did get modified.
This gets caught with EXPENSIVE_CHECKS.
This patch adds a top-level IR save and restore that will restore the IR
when no vectorization has taken place to make sure the IR is back in its
original state, therefore making sure that the returned value is
correct.
[lldb] [NFC] Remove the text test before `print`'s expression path (#245576)
`dwim-print` tries an expression-path step before the expression
evaluator,
and skips it for any expression whose text holds `->`, `*`, `&`, `[` or
`]`.
The reason of the test belongs to the pre-DIL expression-path code,
`StackFrame::LegacyGetValueForVariableExpressionPath`, which split the
string itself and had no notion of an operator. #243651 removed that
code.
`GetValueForVariableExpressionPath` now always lexes and parses the
expression with DIL. `dwim-print` passes `lldb::eDILModeSimple`, whose
lexer accepts only `identifier`, `period` and `eof`. Each character the
text test looks for lexes to a token that mode rejects, so the
expressions
this now admits to DIL fail there and fall through to the expression
evaluator, which is where the text test sent them before.
[CodeGen] Fix isDef() assert on metadata operands in hasImplicitDef (#239703)
The MachineVerifier allows metadata and MC-symbol operands after an
instruction's explicit operands in
`MachineOperand::isValidExcessOperand()`. These operands appear in
`implicit_operands()`, but `MachineInstr::hasImplicitDef()` assumes
every operand in that range is a register and calls `isDef()` on each
one. An instruction that the verifier accepts can therefore trip the
"Wrong MachineOperand accessor" assertion when a pass asks whether it
has an implicit def.
This PR checks that an operand is a register before querying whether
it's a def, matching the neighbouring `MachineInstr` helpers such as
`allImplicitDefsAreDead()`. It also adds the same check in
`TargetInstrInfo::commuteInstructionImpl()`. Without it, an instruction
with both a metadata operand and an implicit register def would reach an
unchecked `getReg()` call in the loop that updates implicit defs.
[LLDB] Add data formatter for Rust vectors. (#239745)
Set up the basic framework for adding Rust data formatters, and add a
data formatter for Rust vector types.
[AMDGPU][NFC] Clean up HasUses in SIFixSGPRCopies::processPHINode
Use !MRI->use_empty(PHIRes) instead.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[SPARC] Print the full trap number (#245511)
The instruction printer masked the trap number of Tcc with 0x7f. That
came from 52adb575e617, which also added a custom decoder that read
only 7 bits of the trap number. 099001979fe8 removed that decoder, so
the disassembler now decodes the 8-bit field that Tcc encodes, and the
mask cut off bit 7: ta 0x80 printed as ta 0 and ta 0xff as ta 127.
Drop the special case and print the trap number like any other
immediate.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[libc] Fix unsigned underflow in string_to_float.h. (#245745)
`pos_len` is an `int32_t`, but is computed using the difference of
`uint32_t`s. Cast to signed before doing the arithmetic so that clamping
`pos_len` on the following lines works.
Assisted-by: Automated tooling, human reviewed.
[Transforms] Remove write-only and unused members (NFC) (#245544)
ModuleAddressSanitizer::Recover: Added on November 11, 2015 in commit
d7731988ef44c9417a79bd4db042183a60900f14 without any readers. This
patch also removes its initializer and the now-unused Recover
constructor parameter.
ModuleMemProfiler::Mapping: Added on August 13, 2020 in commit
7ed8124d46f94601d5f1364becee9cee8538265e without any readers. This
patch also removes its initializer.
ModuleSanitizerCoverage::FunctionPCsArray: The last readers were removed
on September 13, 2018 in commit
3bea25e5543606758ab10d395b1e7283255be75b. This patch also removes its
assignments and drops the now-unused return value of CreatePCArray.
SCCPInstVisitor::Ctx: The last reader was removed on June 19, 2023 in
commit 664b7a4cd51d9273888e79688f64cc8bbcbdbe25. This patch also
removes its initializer and the now-unused Ctx constructor parameter.
[5 lines not shown]
[ARM] Remove write-only private member variables (NFC) (#245543)
ARMFastISel::TM: The last readers were removed on August 20, 2026 in
commit 239b30e2f5bd11df57e7c4a054bf3a9b7b0bd714. This patch also
removes its initializer.
ARMLowOverheadLoops::MRI: The last reader was removed on September 17,
2019 in commit 36c922278e6e7fb2083dc29dda950dfac73a194c. This patch
also removes its assignment.
Assisted-by: Antigravity
Bitstream: Decode single-chunk VBR fields inline
Share one decoder between ReadVBR and ReadVBR64, decode the first chunk
inline from a word load, and only call out of line for the remaining
chunks. The inline part is always_inline because GCC otherwise clones
ReadVBR out of line, which made bitcode reading slower.
Instructions in parseIRFile with opt -passes=verify:
clang 23 GCC 15
k.bc -6.17% -0.14%
cnf.bc -5.93% +0.74%
sqlite3 -5.02% -0.38%
z08.bc -4.54% -0.56%
Whole opt -O3 runs: -0.14% to -0.47% with clang, within 0.02% with GCC.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[SPIR-V] Use one helper for temp registers in the selector (#241373)
Some temp registers in the selector were made with
createVirtualRegister, which sets the full LLT. For wide vectors this
LLT is larger than the register class, so builds with assertions fail with
"VReg's low-level type and register class have different sizes",
for example on uitofp <8 x i1> to <8 x float>.
Add createTempVReg, which sets only the register class and the SPIR-V
type. Use it instead of createVirtualRegister, and in the places that did the
same steps by hand.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[C][Clang] Fix some formatting issues; NFC (#245730)
This puts the css class in the right place and fixes a misnumbering (we
had two issues numbered 1024).
[DAG] Add getFreeze(SDValue, UndefPoisonKind) variant (#245320)
Makes it easier to filter for just POISON/UNDEF cases, which will be
more common in upcoming patches - but avoids the need for manual
DemandedElts handling.
I had hoped to entirely remove the isGuaranteedNotToBeUndefOrPoison
check inside getNode() but there's a lot of code changes due to
different SDLoc etc. that should be handled separately.
[AMDGPU] Promote 16-bit return to i32 in the calling convention (#245288)
A follow up patch of https://github.com/llvm/llvm-project/pull/242694.
Same promotion for return
Co-authored-by: Claude Opus 5.5
[noreply at anthropic.com](mailto:noreply at anthropic.com)
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply at anthropic.com>
[MLIR][XeGPU] Add a barrier after SLM reads in WgToSg distribution (#245104)
The SLM paths of convert_layout and of the cross-subgroup
multi_reduction emit store_matrix, gpu.barrier, then load_matrix, with
no barrier after the read. Inside a loop, a subgroup that finishes
reading can start the next iteration and overwrite the buffer while
another subgroup is still reading it. Add a barrier after the reads, so
the buffer is not rewritten until every subgroup has read it.
Found through IMEX layer_norm_4096x4096, which produced wrong results
once a convert_layout through SLM ended up inside its K loop.
assisted-by-claude
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[ConstantFolding] Fold constrained fpext of a constant (#244838)
An fpext is exact in every rounding mode, so the only floating-point
exception it can raise is invalid for a signaling NaN input. Fold
llvm.experimental.constrained.fpext of a constant, using
mayFoldConstrained to decide the signaling NaN case like the other
constrained intrinsics.
Without this, -frounding-math leaves a runtime conversion of a constant
behind. On targets with a soft fp128 that is a libcall, e.g.
_Qp_dtoq/_Qp_stoq on sparc64.
Update f21 in fp-intrinsics.ll, which expected the call to stay.
Fixes #244637
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DAG: Use the LibCall action for atomic operations lowered to calls
An Expand action on an atomic operation without an expansion falls
back to libcall lowering. Switch the VE atomicrmw operations and the
ARM and CSKY fences which relied on this fallback to LibCall, so the
action reflects whether the operation is intended to emit a call.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[SandboxVec][LoadStoreVec] Support mixed-type store vectorization of arbitrary values
vectorizeStores() only handled chains whose stored values were all
consecutive loads or all constants. Any other chain, e.g., storing
function arguments or computed values, was left alone.
Pack such values into a vector with createPack(). For a chain of mixed
types the vector has integer lanes, so each value is first
reinterpreted (bitcast / ptrtoint) as the lanes it occupies with
Reinterpret::reinterpretValue(), and a value spanning several lanes is
inserted lane by lane. The pack is placed right before the vector
store, where every stored value is available. Whether this pays off is
left to the existing cost check in acceptOrRevert().
Chains storing a non-integral pointer are left alone.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
Co-authored-by: Cursor <cursoragent at cursor.com>
[SandboxVec][LoadStoreVec] Vectorize store chains whose loads have external uses
Loads that feed a store chain used to block vectorization whenever
they had more than one use. Now the store chain can be vectorized even
if the loads have external uses. Once the scalar stores are erased,
each original load is rebuilt from the lanes it occupies in the new
vector load, and reinterpreted back to its original type if needed,
using canUnpackLoads() and unpackLoads().
The legality check runs before any IR is created, so a load whose lanes
cannot be reinterpreted (for example, a non-integral pointer) rejects
the whole chain instead of leaving a partially rewritten block.
Co-authored-by: Cursor <cursoragent at cursor.com>
[SandboxVec][LoadStoreVec] Factor out canUnpackLoads and unpackLoads (NFC)
Move the logic that unpacks each original load from the lanes it
occupies in a vector load, and the check that those lanes can be
reinterpreted as the load's type, out of vectorizeLoads() into the new
canUnpackLoads() and unpackLoads() helpers.
This is in preparation for sharing the unpacking with vectorizeStores(),
so that store chains whose loads have external uses can be vectorized.
Co-authored-by: Cursor <cursoragent at cursor.com>
[SPIR-V] Serialize the last inserted type in MIR (#245276)
Without it, types and constants created after MIR load go to the start
of the entry block and change the output order