[AMDGPU] Remove unused AMDGPUOperand::setImm (NFC) (#243539)
setImm was added specifically for parseFORMAT on July 24, 2020 in commit
6b8948922c59c9f786996387b41d8e29ed3e7a8a. The last caller was removed
on November 17, 2026 in commit 051b6b06f1b6e8763dae66b70205447e40d4b5ff,
which split parseFORMAT into parseFormat and parseFormatOp.
Assisted-by: Antigravity
[Attributor] Remove unused PotentialValuesState::getBestState (NFC) (#243404)
The last caller of the zero-argument overload was removed on November
16, 2026 in commit 2218d6214d547b52b1122d85151f799a10301560.
Assisted-by: Antigravity
[lld][MachO] Remove -no_objc_relative_method_lists from tests (#243254)
`-objc_relative_method_lists` was enabled by default in
https://github.com/llvm/llvm-project/pull/104519, but it left
`-no_objc_relative_method_lists` in a bunch of tests. Remove the flag
from the tests and fix them.
LLM assisted
[VPlan] Cost ExtractLane by the type of the vector it extracts from. (#243633)
ExtractLane's first operand is the lane index, and VecTy had an
incorrect element type.
Use getScalarType, which handles result types of both ExtractLane and
ExtractElement correctly.
[objdump] Fix relative method pointer size (#243250)
Some pointers in `print_relative_method_list()` were printed assuming
the wrong size. Fix that by using `PRIx64`. Also compare `pointerBits ==
64` rather than `pointerSize` which is the number of bytes, not the
number of bits. Lastly use `get_pointer_64()` since the input is 64
bits.
Add a test that uses `update_test_body.py` to dump YAML for the input.
LLM assisted
[LFI][AArch64] Account for deferred LR guard flush in getInstSizeInBytes (#224791)
In AArch64MCLFIRewriter, any control flow instruction (branches, calls,
returns)
can trigger flushing of an active DeferredLRGuard, emitting a `4-byte`
link-register
mask (`add x30, x27, w30, uxtw`) immediately before the instruction.
To preserve generic pseudo-instruction sizing (such as `TCRETURN*`)
while accounting
for the flush, wrap `AArch64InstrInfo::getInstSizeInBytes` by
calculating the exact
value for all control-flow instructions then adding a `4-byte`
overestimate for LFI. It did
require adjusting LFI-specific sizing for indirect and authenticated
tail calls as well as
the `TLSDESC` call sequences in the calculation. These estimates are
verified in LFI's
InstSizes and CodeGen tests.
Assisted-by: Gemini
[flang][Evaluate] Analyze contiguity and copies per consequent-arg (#238055)
The contiguity and copy-in/copy-out analysis that semantics and lowering
use treated a conditional argument (F2023 R1526) as a single expression.
It answered from the condition or from the first consequent-arg. The
actual argument is the consequent-arg chosen at run time (F2023 15.5.2.3
p2), so the analysis has to account for every consequent-arg. This is
also the base for lowering conditional arguments. Without it, an array
conditional argument passed to a CONTIGUOUS dummy argument wouldn't get
the copy-in it needs.
Contiguity:
- IsContiguous() had an overload for ActualArgument that no caller
reached, because the header declared only the function template. The
template traversed the whole argument; it saw the scalar condition first
and reported every conditional argument as contiguous. Declare the
overload in check-expression.h with default arguments and remove the
template's explicit instantiation for ActualArgument. Other actual
arguments get the same answers as before.
[74 lines not shown]
[CIR] Separate language alignment from ABI alignment (#243165)
CIR's use and backing implementation of
mlir::DataLayout::getTypeABIAlignment conflated two similar but distinct
concepts. One thing this can refer to is the alignment that will be
assumed for the type when it is lowered to LLVM IR. This determines
array stride and field offsets, padding, and packing for records. The
other possible meaning is the alignment the source language requires for
objects of the type on the target platfrom. This determines alignment of
allocas, globals, and memory accesses and is also used in calling
convention lowering. These two alignments usually agree, but not always.
This change introduces a new method, getTypeLanguageAlignment, in
CIRDataLayout and uses that method when the source language alignment is
needed. This does not yet correctly handle the AArch64 vector alignment
issue, as the needed infrastructure for that was being introduced in
another PR when the problem I'm fixing here came up during the review.
Assisted-by: Cursor / claude-opus-5.5
[llvm-profgen] Cache and explain the pre-inliner hot threshold
Compute the hot threshold once in the CSPreInliner constructor instead
of recomputing it for every caller. The input summary stays fixed for
the pre-inliner run.
Document why the ICP checks keep the contextless summary. The loader's
nested summary depends on the inline decisions and can give a lower
threshold. Using a lower estimate could let more indirect targets spend
the caller's inline size budget, leaving less room for other callees.
Rejected contexts instead follow the existing base-profile merge path.
The loader continues to apply its own hotness check.
Clarify nearby comments and diagnostics so a pre-inliner rejection is
not presented as an exact prediction of the loader. Add coverage for an
explicit hot-count override. Profile selection is unchanged.
Assisted-by: GPT-6 Astra
[libc] Add sys/timerfd.h and timerfd_create on Linux. (#243360)
* Add `<sys/timerfd.h>` header on Linux platforms.
* Provide macro definitions for `TFD_*` constants, and ensure `CLOCK_*`
values are also available.
* Implement one of the syscall wrappers defined in this file -
timerfd_create (as a straightforward syscall wrapper).
* Add a simple unit test that validates that returned fd has correct
flags and can be read/closed.
See https://man7.org/linux/man-pages/man2/timerfd_create.2.html for the
docs.
[LLD][COFF] Avoid repeated vector insertion during thunk creation (up to 10x improvement for large links) (#241059)
Inserting each range-extension thunk into OutputSection::chunks shifts
the remaining chunk pointers. When many chunks need thunks, this makes
chunk-list construction quadratic.
Append the original chunks and their thunks to a new vector and swap it
into the output section, preserving their order and the existing thunk
placement, reuse, relocation rewriting, and retry policy. Newly created
range-extension thunks need no additional visit because they inherit the
no-op extendRanges implementation.
On my x64 Windows machine it reduces a large ARM64 debug link from 43
minutes down to 2 minutes.
Tested with ninja -C build check-lld-coff: 559 passed, 6 unsupported.
Assisted-by: GitHub Copilot CLI (GPT-6.1 Sol)
[llvm-objdump] Start an ARMNT export at its even address (#242496)
On ARMNT the export RVA of a Thumb function has its low bit set.
llvm-objdump used it as the symbol address, so it disassembled
each export from the odd address and everything after the first
export came out one byte off. I hit this checking DLLs built for
Windows on Arm.
This clears the low bit of an export in a code section.
Assisted-by: Claude Opus 5.5 (Anthropic)
Co-authored-by: Saleem Abdulrasool <compnerd at compnerd.org>
RegisterCoalescer: Only shrink subranges in ShrinkMask after a join
When joinCopy needs to shrink the main range, shrinkToUses was called
on the whole interval. This also shrinks every subrange. If the join
did not set ShrinkMainRange, no subrange is ever shrunk, so the join
is already trusted to leave only the subranges in ShrinkMask needing
it. The other reasons for shrinking the main range (pruned main range
values, uses that now read only undef lanes) do not change any
subrange. Pass ShrinkMask to shrinkToUses to restrict which subranges
it shrinks, unless the source interval was in ToBeUpdated.
llc instructions:u, AMDGPU sample: -0.11%
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
RegisterCoalescer: Don't shrink pruned subranges twice (#243347)
updatePrunedSubRanges shrank each subrange in ShrinkMask and then set
ShrinkMainRange, which makes joinCopy call shrinkToUses on the whole
interval. That shrinks every subrange again, so the first shrink was
redundant. Only set ShrinkMainRange.
llc instructions:u, output identical:
CTMark x86_64: -0.04%
CTMark arm64: -0.02%
AMDGPU sample: -1.09%
Largest AMDGPU improvements:
rocsolver stedc (gfx942): -8.77%
rocsolver stedcx (gfx942): -8.66%
rocprim warp_sort (gfx1100): -7.21%
rocsolver potf2-specialized-kernels-d (gfx942): -7.07%
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
CodeGen: Skip main range predecessor lookup in shrinkToUses (#243346)
When a value is live-in to a block, extendSegmentsToUses looked up the
old value live-out of each predecessor. The main range always has one,
and it must be the same value, so the lookup is only needed for
subranges, where undef lanes can leave a predecessor without one.
llc instructions:u, AMDGPU sample: -0.11%
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[HLSL][Matrix] Make `*`, `/`, and negation element-wise on matrices (#241993)
Fixes #241086.
This PR makes `*` and `/` between two matrices element-wise, like they
are for vectors, and allows unary `+` and `-` on matrices. It also adds
sema and codegen tests covering these operators.
Assisted-by: Claude Opus 5.5
[clang] Locate backend diagnostics under -fdebug-prefix-map (#242548)
Backend diagnostics are mapped back to a clang SourceLocation by
looking up the file name recorded in the debug info. With
-fdebug-prefix-map that name is the remapped path, which usually does
not exist, so the lookup fails and the diagnostic is reported at the
enclosing function instead. If the function lies outside the
"#pragma clang diagnostic ignored" region covering the real location,
the suppression is lost, and a build that passes without the prefix
map fails with -Werror. The notes of -fdiagnostics-show-inlining-chain
have the same problem.
Record which source file each DIFile was created for when CGDebugInfo
creates it, and resolve debug locations through their DIFile instead
of its file name. DiagnosticLocation and DebugInlineInfo now provide
the DIFile for this. Debug info that clang did not generate, e.g. from
LLVM IR input, still falls back to the file name. Files with line
directives are left out, because their debug locations use presumed
lines. Without checksums, distinct files whose remapped names are
[4 lines not shown]
[FuncSpec] Refactor Latency/CodeSize threshold checks (#242832)
The current checks against thresholds for Latency and CodeSize savings
currently contain integer division. For functions that are small, the
truncation towards zero can cause us to admit specializations that have
savings that are actually below the threshold due to the loss of
precision in the calculation.
The existing CodeSize check is:
`CodeSizeSavings < funcspec_min_codesize_savings * FuncSize / 100)`
If the minimum CodeSize savings is set to 20(%), the RHS of this
comparison will truncate to 0 for any FuncSize less than 5, and so even
a CodeSize saving of 0 will be admitted.
If the minimum CodeSize savings is set to 20(%) and the FuncSize is 8,
the threshold should be 1.6 CodeSize units saved; however the division
will truncate to 1 and so admit a CodeSize saving of below this expected
value.
[5 lines not shown]
[Offload] Make lit aware of AMDGPU plugin-level option (#243610)
The lit tester runs in a sanitized environment. That means that if one
wants to run the full lit test suite under a specific env var setting,
the test lit driver needs to be aware of the option.
For single test-level setting, this can be done through the RUN lines as
before.
Reapply "X86: Use the DataLayout size in the atomic expansion hooks (#243118)" (#243611)
This reverts commit 970a9c95cf21e946f2de12d7e781e17d2d7b0f5b.
The original version removed the MemType local from
shouldExpandAtomicRMWInIR, which conflicted with the vector atomicrmw
expansion added in #230788. Use the DataLayout size in the vector case
too.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[KnownFPClass] Be conservative with x87 non-canonical NaN for KnownFPClass::bitcast (#242483)
Currently, APFloat's classification of non-canonical NaN may be
inconsistent with real x87 FPU behavior. To be conservative, we will
only rule out qNaN/sNaN for x87 canonical NaN. Non-canonical NaN will be
treated as `fcNan`, and will not be refined to `fcQNan` or `fcSNan` for
`KnownFPClass::bitcast`.
`x86_fp80` is not as commonly used, so it is better to make a
conservative fix instead of having a silent miscompilation.
In response to
https://github.com/llvm/llvm-project/pull/224072#issuecomment-6723974270