[BOLT][AArch64] Clone constant islands for ADR with relocation (#240465)
BOLT skips the relocation of an LDR literal, so its target goes through
handleAddressRef(), which clones another function's constant island
unless with --clone-constant-island=0 or that the constand island has
dynamic relocation. An ADR with R_AARCH64_ADR_PREL_LO21 would use its
relocation instead and always referenced the original constant island.
We now treat these two the same by symbolizing such an ADR from its
PC-relative value during disassembling, so the decision on whether to
clone the referenced constant island can be made the same way.
[BOLT][DWARF] Keep rewritten locexpr record with base type reference (#242064)
Some DWARF location expressions contain both an address index and a
reference to a type DIE, e.g. "DW_OP_addrx 128, DW_OP_convert <int>".
BOLT updates them in two steps:
1. DWARFRewriter replaces the address index with the index of the
address in the new .debug_addr.
2. Later, once the final DIE offsets are known, DIEBuilder fills in the
offset of the type DIE.
Step 2 rebuilt the expression from the input file, so it undid step 1
and put the old address index back. The index is a ULEB128, so the old
and new values can take a different number of bytes. The expression then
no longer had the size the unit was laid out with, so the unit length
was wrong and tools reading the DWARF lost every unit after it.
Make step 2 start from the expression written by step 1. For that, step
[4 lines not shown]
[MLIR][XeGPU] Reuse a consumer slice layout that slices other dims in multi_reduction (#245361)
[MLIR][XeGPU] Reuse a consumer slice layout that slices other dims in
multi_reduction
The multi_reduction layout rules reuse the consumer's slice parent only
when the slice dims equal the reduction dims. A consumer layout often
slices other dims, e.g. after a broadcast and a transpose: the reduction
removes dim 1 while the consumer is slice<P, dims = [0]>. That layout is
the same as slice<P', dims = [1]>, where P' is P with its dims permuted
so that the sliced dims land on the reduction dims and the kept dims
stay in order.
assisted-by-claude
---------
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[Passes] Honor module Attributor options in FullLTO (#230759)
Run the full Attributor after WPD in FullLTO when enabled. Keep
module-light before WPD; default behavior is unchanged.
RISCV: Include the target ABI in the subtarget key
The subtarget depends on the target-abi module flag, so modules with
different ABIs need different subtargets.
Assisted-by: Claude
[clang] Guard identifier reads in pragma handlers (#230927)
Nested `_Pragma` or Microsoft `__pragma` expressions can produce
annotation tokens in an enclosing pragma's arguments. This patch fixes
crashes when these tokens are processed as arguments or used to
construct diagnostics, and improves error recovery for nested pragmas.
``` cc
#pragma vtordisp(push, _Pragma("weak foobar"))
```
After the inner `_Pragma` is processed, the enclosing pragma receives an
annotation where it expects a mode argument. Similar cases occur when
arguments are buffered and parsed later.
Previously, these paths called `getIdentifierInfo()` and then checked
whether the result was null. The assertion occurs inside the getter, so
checking its return value cannot prevent the crash.
[5 lines not shown]
X86: Include the stack alignment override in the subtarget key
The subtarget depends on the override-stack-alignment module flag, so
modules with different values need different subtargets.
Assisted-by: Claude
LoongArch: Include the target ABI in the subtarget key
The subtarget depends on the target-abi module flag, so modules with
different ABIs need different subtargets.
Assisted-by: Claude
Mips: Include the stack alignment override in the subtarget key
The subtarget depends on the override-stack-alignment module flag, so
modules with different values need different subtargets.
Assisted-by: Claude
[CIR] Guard full-width shift in CIRGenFixedPointBuilder (#244504)
Casting unsigned _Fract to an integer shifts by its full width, since
scale == width.
Follows https://github.com/llvm/llvm-project/pull/239969.
[SLP]Choose the cheapest nodes for gather shuffles
The first matching node is not always the cheapest one. All candidate
nodes are collected per register part, the gather cost picks the
cheapest choice and codegen emits the same one. Lanes of vectorized
scalars with the same VF are priced as shuffles instead of inserts.
Assisted-by: Cursor
Pull-request: https://github.com/llvm/llvm-project/pull/243943
Reviewers: MrSidims, RKSimon, bababuck
Reviewed-by: bababuck
[RISCV][GISel] Support scalable vector zext and sext in the IRTranslator (#248359)
Allow scalable vector zext and sext in
RISCVTargetLowering::fallBackToDAGISel. The legalizer, register bank
selection and instruction selection already handle G_ZEXT and G_SEXT on
scalable vectors. Extends from a mask select to vmerge.vim now that
constant splats and SplatPat_simm5 are supported.
Part of #246831
[mlir][AMDGPU] Keep alignment when lowering masked loads and stores (#221308)
The `amdgpu-maskedload-to-load` patterns rebuild a `vector.maskedload`
as `vector.load` (and a full-mask `vector.maskedstore` as
`vector.store`) from the original base and indices, but do not forward
the `alignment` attribute. The lowered op then falls back to the
element alignment in `convert-vector-to-llvm`:
```mlir
%0 = vector.maskedload %mem[%i, %i], %mask, %pass alignment = 16 : memref<8x8xf16>, vector<4xi1>, vector<4xf16> into vector<4xf16>
```
```
// before: llvm.load %p {alignment = 2 : i64} : !llvm.ptr -> vector<4xf16>
// after: llvm.load %p {alignment = 16 : i64} : !llvm.ptr -> vector<4xf16>
```
The rewritten access uses the same base, indices and vector type, so
the alignment the user asserted on the masked op still holds. Pass it
[4 lines not shown]
BSD.tests.dist: Add entry for bsdconfig
Fixes: 9ffe2919e6b6 (bsdconfig: Resolve GEOM ids and names without scanning)
Sponsored by: The FreeBSD Foundation
[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. reloc-opt.ll gets an NF add that keeps
its source live, because compaction compresses the existing one to the
legacy form. inline-spiller-hoist-folded-copy.ll gets four empty asm
[2 lines not shown]
[X86] Clear _all_ register aliases in dynamic call RegMasks for preserve_most/all (#241595)
Previously, the code only removed _subregisters_ (inclusively) from the
register mask when removing registers for CCs like `preserve_most` or
`preserve_all`.
But when we do `MRI.disableCalleeSavedRegister`, it removes aliases
including superregisters and their aliases. Leaving the superregisters
marked as preserved can cause sibling subregisters to get clobbered
across `preserve_most` calls:
https://cpp.compiler-explorer.com/z/GjxerTYnz
The fix is to clear all subregisters of the root superregisters of the
disabled register.
Assisted-by: Antigravity with Gemini
ipfw_nat: Report a redirect that cannot be set up
nat44_config() ignores the error from add_redir_spool_cfg(), which
stops at the first redirect it cannot set up: one with an unknown mode,
a port redirect without ports or with a protocol other than TCP, UDP or
SCTP, or one for which libalias cannot allocate a link. That redirect
and the ones after it are dropped silently, but the instance keeps the
redirect count of the request, so "ipfw nat N show config" reports more
redirects than it returns and ipfw(8) misreads the reply ("unknown redir
mode"). A port range that runs out of memory partway also leaves its
first links in libalias.
Return the error, count only the redirects that are set up, and delete
the links of a port range that fails. As before, the instance stays
installed with the redirects ahead of the failed one. Add a
nat44_config test case for a redirect without ports.
Reviewed by: maxim
Fixes: d6164b77f8b7 ("Make ipfw_nat module use IP_FW3 codes.")
[3 lines not shown]
Float2Int: Replace -float2int-max-integer-bw cl::opt with pass parameter
Migrate the pass-specific command-line option to a new pass manager
pass parameter, exposed as float2int<max-integer-bw=N>.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
[MC] Only treat STT_SPARC_REGISTER as a register symbol for SPARC V9 (#248730)
STT_SPARC_REGISTER is STT_LOPROC, which other targets can use for their
own symbol type. Only give it the SPARC register symbol handling in
the ELF writer when the machine is EM_SPARCV9.
Reported by nvjle in
https://github.com/llvm/llvm-project/pull/246970#discussion_r4792717748
Assisted-by: Claude Opus 5.5
Thread SharedSampleProfile through PGOOptions and SampleProfileLoader.
Parallel pass pipelines such as rustc codegen workers need a way to pass a
pre-parsed `SharedSampleProfile` into `SampleProfileLoader` without reopening
the profile per module. Add an optional `SharedSampleProfile` field to
`PGOOptions` (asserting `Action == SampleUse` in `PGOOptions::resolve()`) and
forward it through `SampleProfileLoaderPass` to `SampleProfileReader::create`
and `takeSharedProfileSymbolList()`.
Use const ProfileSymbolList in SampleProfileLoader and SampleProfileMatcher.
Neither class mutates the symbol list. Making it const lets SampleProfileLoader
switch to SampleProfileReader::takeSharedProfileSymbolList(), which returns a
const pointer so a SharedSampleProfile can share it across parallel modules.
Support struct-style initialization for PGOOptions.
Constructing `PGOOptions` previously required 10 positional arguments with
empty placeholder strings, making new fields noisy to add. Add default member
initializers, a default constructor, and `PGOOptions::resolve()` (called by
`PassBuilder`), migrate callers, and remove the positional constructor.
Support context-sensitive ExtBinary profiles in SharedSampleProfile.
Context-sensitive ExtBinary profiles store callsite context frames in
`SecCSNameTable` and hash them lazily into `MD5SampleContextTable`, which
previously rejected sharing. Share immutable `SecCSNameTable` data through
`SampleProfileReaderBinary::CSNameTable`, populate the CS atomic MD5 vector
while guarding section ordering against `SecProfSummary`, and exercise
concurrent CS and non-CS readers under TSAN.
[lldb] Print the thread status in `thread select` (#248714)
Since c3faa1957735, `thread select` has not printed the new thread's
status itself. It broadcasts a thread-selected event, and the default
event handler prints the status when it receives it. `frame select`
prints its result directly.
The command result of `thread select` is therefore empty. A caller of
SBCommandInterpreter::HandleCommand can neither capture nor suppress
the status.
The event handler thread also prints while the next command runs. In a
breakpoint command, `thread select` followed by `bt` has both threads
format the same Objective-C argument, which sets up the language
runtime on first use, and LLDB can crash.
Print the status in the command, as `frame select` does, and stop
handling the event in the default event handler. Other clients still
receive it.
[6 lines not shown]