[SystemZ][z/OS] Emit when passing vector types without vector extension
Currently, there is no ABI defined on z/OS for passing vector types
when the vector extension is disabled/not available. Emit an error
message for this case while we are working on extending the ABI.
This is a temporary measure until the ABI is defined.
[SystemZ] Use VBPERM to lower bitcast of <N x i1> to iN
On z14 and later (vector-enhancements facility 1), combine a bitcast
of v2i1, v4i1, v8i1 or v16i1 to the same-width integer (a "movemask")
into VECTOR BIT PERMUTE followed by a halfword extract. The lanes are
sign-extended to fill a 128-bit register, so a vector compare feeding
the bitcast needs no extra work. A constant index vector gathers the
top bit of each lane, with lane 0 landing in the most significant bit
of the result as before. Unused leading bytes use index 128, which
selects a zero bit.
This replaces about 34 instructions (vlgvb, risblg/rosbg, llhr) for
the v16i1 case with vbperm and vlgvh, plus a constant-pool load.
Reductions such as icmp eq/ne (bitcast (icmp ...)), 0/-1 are left to
combineSETCC so they keep using the condition code (vceqbs).
Assisted by: IBM Bob
[libc++] Optimize num_put a bit more (#245988)
`__identify_padding` checks what characters are at the start of the
formatted string, but we know what we put there, so we can keep track of
that instead and adjust the padding position based on that.
[llvm-size] Refactor output formatting into SizePrinter classes (NFC)
Introduce a class-based SizePrinter abstraction (SummarySizePrinter,
BerkeleySizePrinter, SysVSizePrinter, DarwinSizePrinter) to encapsulate
format-specific state and output logic instead of branching on
OutputFormat across printObject and printObjectSectionSizes.
Move per-run state (HeaderPrinted and totals) from file-scope globals
into printer instances, preparing llvm-size for cleanly adding
additional output formats such as GNU (-G / --format=gnu) and JSON.
Assisted-by: Gemini
[SelectionDAG] Ask MachineFrameInfo whether an alloca can be static (#246290)
FunctionLoweringInfo makes an over-aligned static alloca a dynamic
allocation when the stack can't be realigned, but it asked
TargetFrameLowering, which doesn't see "no-realign-stack". So in such a
function the alloca stayed a fixed stack object, and MachineFrameInfo
silently clamped its alignment to the stack alignment. Ask
MachineFrameInfo instead, both whether the stack can be realigned and
what the function's stack alignment is ("alignstack" can raise it), as
its comment on StackRealignable describes. The tests with over-aligned
allocas in no-realign-stack functions now get an aligned dynamic
allocation. Noticed in #240693.
Assisted-by: Claude Opus 5.5 (Anthropic)
[AMDGPU] Check all AGPRs before skipping MFMA copy rewrite (#231714)
The MFMA copy rewrite checks only AGPR0 to decide whether a function
allocated any AGPRs. This can skip valid copy and MFMA rewrites when
only higher AGPRs have assigned live intervals.
In HIP kernels with SGPR spills, whole-wave copies can occupy low AGPRs
before final vector allocation. These physical uses are not virtual
intervals in the final allocation matrix, so the allocator can assign
higher AGPRs while AGPR0 has no assigned live interval.
The same case remains when the low AGPRs are reserved for whole-wave
values. Check the full AGPR register class before exiting.
AI assisted.
[CodeGen] Declare command line options of the machine pipeliner in TableGen (#246484)
WindowSchedulingFlag becomes an enum class with WS_On, the -window-sched
default, as its zero enumerator.
-pipeliner-opt-size reads its value, so -enable-pipeliner-opt-size=false
no longer enables the pipeliner at -Os. -pipeliner-dbg-res and
-pipeliner-show-mask, read only in LLVM_DEBUG, exist only in assertions
builds.
Renames, with the old spelling kept as an alias:
```
-enable-pipeliner-opt-size -> -pipeliner-opt-size
```
LLM-aided
[analyzer][NFC] Use a base region map in RemoveDeadBindingsWorker (#246433)
RemoveDeadBindingsWorker looked up the cluster of a region in the store
every time it was added to the worklist, and tracked visited clusters in
a separate set that it probed again when filtering the store.
Record every cluster and a visited flag in a map from the base region
when the clusters are generated, so adding a region to the worklist is a
single hash lookup. If every cluster is live, return the store
unchanged. The worker no longer uses ClusterAnalysis.
On some LLVM TUs (GVN, LiveVariables, RegionStore, SemaExpr) this
reduces the instructions of the static analyzer by 2.5-3.3%.
Assisted-by: Claude Opus 5.5
---------
Co-authored-by: Gabor Horvath <gaborh at apple.com>
[cmake] Escape compiler launchers in the NATIVE configure command (#246475)
Newer ccache versions support specifying options directly on the command
line. Make sure `-DCMAKE_<LANG>_COMPILER_LAUNCHER` is correctly
propagated to the NATIVE sub-build if the user passed a list.
Assisted-By: Claude
Co-authored-by: Claude Sonnet 5.5 <noreply at anthropic.com>
[LifetimeSafety][NFC] Use one allocator per analyzed function (#246490)
Each of the four immutable collection factories created its own
BumpPtrAllocator, and the fact, origin list and loan managers had one
each, so every analyzed function allocated seven slabs and four
allocator objects even when it produced only a handful of facts. Most
functions are small, so this setup dominated their cost. Allocate
everything from a single allocator owned by LifetimeSafetyAnalysis.
On some LLVM TUs (GVN, LiveVariables, RegionStore, SemaExpr) with
-fsyntax-only -Wlifetime-safety, this reduces the instructions of the
lifetime safety analysis by 4.7-8.8% (0.6-0.9% of the whole
compilation).
Assisted-by: Claude Opus 5.5
Co-authored-by: Gabor Horvath <gaborh at apple.com>
[LifetimeSafety][NFC] Skip the moved loans analysis for functions without moves (#246489)
Most functions do not pass anything to an rvalue reference parameter, so
no loan is ever moved and the analysis computes an empty map at every
point. Record whether a MovedOriginFact was created and skip the
analysis otherwise.
On some LLVM TUs (GVN, LiveVariables, RegionStore, SemaExpr) with
-fsyntax-only -Wlifetime-safety, this reduces the instructions of the
lifetime safety analysis by 5.3-7.3% (0.5-0.8% of the whole
compilation).
Assisted-by: Claude Opus 5.5
Co-authored-by: Gabor Horvath <gaborh at apple.com>
[libc++][pstl] Add a parallel implementation of exclusive scanning (#244683)
This PR generalises the existing implementation of parallel
`transform_inclusive_scan` to support both inclusive and exclusive
scans.
The implementation is pulled out into a new free function
`__statpart::__transform_scan()` that gets an additional template
parameter specifying the flavour of scanning.
Depending on that parameter the leaf scanning lambda implicitly switches
between inclusive and exclusive scans.
Both `inclusive_transform_scan` and `exclusive_transform_scan` just call
this new function with a different template parameter, i.e.
`__transform_scan</*inclusive=*/true>(...)` and
`__transform_scan</*inclusive=*/false>(...)`.
[llvm-cov] Look up expansion regions by FileID with binary search
Region vectors are already sorted by FileID, so filtering for one file
is just selecting a contiguous subrange. Do that with a binary search
instead of scanning the whole function.
[CIR] Test lowering of undef and poison aggregate constants
An undef or poison array, record or complex constant lowers to
llvm.mlir.undef or llvm.mlir.poison of the whole type before the
per-type lowering, so the removed isa checks never matched.
Assisted-by: Claude Code (Opus 5.5).
[libc++][pstl] Add a parallel implementation of std::copy_if (#241966)
This PR adds a parallel implementation of `std::copy_if` based on a
single-pass scanning.
Each partition is represented in the look back as the number of elements
for which the user-provided predicate returns `true` (partition
occupancy in other words).
This way the prefix of the loopback partition represents the position in
the destination range where its elements should be copied to.
The predicate flags are stored in a dynamically allocated bitset, which
has a size of `max_partition_size * max_workers_count` bits, aligned to
the cache line size.
[LowerMemIntrinsics] Make TTI non-optional and simplify signature of expandMemSet(Pattern)AsLoop (NFC) (#246090)
Simplify and remove the TTI-pointer null-allowing overloads. Nothing is
currently using them anyway.
[LangRef][MemoryBuiltins] Add support for CHERIoT's heap_allocate and heap_free functions. (#245094)
This requires relaxing the LangRef requirement that `allockind(free)`
functions must return `void`. CHERIoTRTOS' primary heap free API
`heap_free` returns an integer error code, necessitating this change.
Once integer-returning `allockind(free)` functions are permitted, we
also add an extensible path for looking up the return value to substitue
in the case where `free(alloc(...))` is elided. For now we require this
to be 0.
[lld-macho] Collect S_ATTR_LIVE_SUPPORT sections with the markLive roots
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply at anthropic.com>
[clang-format] Use formatted breaks to align trailing comments (#246023)
With Allman braces, the first formatting pass can pad a block comment
after a closing brace to align it with a comment after `else`. The
second pass removes that padding because the brace now starts a line in
the input.
Use the formatter's recorded line-break decision when checking the
closing brace. Fall back to the original whitespace when the token has
no formatting decision.
The new regression failed before the change and passed afterward. All 54
comment formatting tests passed in a Windows build that reapplied this
change to LLVM 23.1.6.
Fixes #245606.
Assisted-by: OpenAI Codex. Draft for contributor review.