[LAA] Conservatively handle compressed pointers
This allows vectorizing loops with `ptr` conditional inductions (that
are used to compute the addresses of loads/stores), and loops where
the pointers may alias (so need bounds checks).
For now, diff checks are not supported if either the source or sink is
a compressed pointer (as the difference may not be constant within the
loop). This could be relaxed for pointers derived from the same phi.
We ensure the over-approximation does not wrap before bounds checking
compressed pointers to ensure the bounds hold for the loop.
All SCEV predicates and bounds checks are frozen as the compressed
access may not occur in the scalar loop (if the condition turns out to
be false for the entire loop), to avoid branching on poison.
Assisted-by: Codex (adding test converage, comments my own).
[Analysis] Move collectCompressedPtrs to IVDescriptors.{cpp|h} (NFC)
`collectCompressedPtrs` needs to be accessible in LAA to handle runtime
checks for compressed ptrs.
[Docs] Fix getTerminator() documentation (#248010)
https://github.com/llvm/llvm-project/pull/189416 changes getTerminator()
to require a well-formed BasicBlock, but didn't adjust the documentation
in the ProgrammersManual.
[lldb][NativePDB] Accept functions without a type (#236547)
When I was trying to trim down the output from llvm with
`-gline-tables-only`, I noticed that lldb doesn't parse functions if
they don't have a type.
It's fine for functions to not have a type in PDB. If you look at the
PDBs from Microsoft's symbol servers, then, if they have functions at
all, they never have types (i.e. type index 0).
With this PR, lldb will accept these functions. They will get a nullptr
`Type*` and an `LLDB_INVALID_UID` for the type UID.
`ResolveTypeUID` couldn't handle that UID before, but now it will return
a nullptr type too.
I added two tests (of the same program). One to check that we can parse
the functions and another one to check that we can generate a backtrace.
I can't use the current clang-cl to compile this, because it would
generate types for functions, so it's using yaml2obj.
[AMDGPU] Invalidate stale UniformityInfo entries in 64-bit div/rem expansion (#215460)
expandDivRem64 erases instructions outside DeadVals worklist, so a freed
instruction address could be reused and misclassified by UniformityInfo
Found as a result of an audit after finding the same class of bug fixed
for Reassociate in #214719
[CIR][OpenMP] Add support for OpenMP reduction clause
This patch adds support for the OpenMP reduction clause on the teams and for
directives for reductions with built-in identifiers on local scalar integer and
floating-point variables. Other cases, such as user-defined reductions,
modifiers, arrays and globals, are reported as not yet implemented.
Assisted-by: Cursor / Claude Opus 5.5 Medium
[clang] Fix crash on trailing comma in vectorize_width
With `#pragma clang loop vectorize_width(4, )`, the token after the comma
is the end marker for the loop hint. The parser diagnoses the missing
argument, then lexes past the marker. Error recovery consumes the
following loop and crashes at the end of the file.
```text
Stack dump:
1. <eof> parser at end of file
2. <stdin>:1:10: parsing function body 'f'
3. <stdin>:1:10: in compound statement ('{}')
```
Leave the end marker for the existing recovery path so parsing resumes
at the following loop. Clang now emits only the malformed hint error.
```text
<stdin>:2:40: error: vectorize_width loop hint malformed; use vectorize_width(X, fixed) or vectorize_width(X, scalable) where X is an integer, or vectorize_width('fixed' or 'scalable')
[6 lines not shown]
[AMDGPU] Handle fp_class conditions in frexp select combine (#248079)
performFrexpSelectCombine removes a select that returns 0 for inf or nan
inputs to frexp_exp, but it only recognized setcc conditions. An isinf or
isfinite setcc is combined into AMDGPUISD::FP_CLASS, and with
-combiner-topological-sorting that happens before the select is visited.
Assisted-by: Claude Fable 5.2 <noreply at anthropic.com>
[MemProf] Don't clone functions whose block addresses escape (#247257)
CloneFunction only remaps block addresses used inside the function body.
If a function's block addresses escape, e.g. through a computed-goto
jump table stored in a global variable, a MemProf clone continues
loading the original function's block addresses and jumps into
the original function's blocks, leading to crashes.
Skip such functions when building the MemProf callsite context graph so
their allocations retain default behavior.
Assisted-by: Gemini
[llvm-size] Add GNU output format (-G / --format=gnu) (#242024)
Implement GNU binutils size -G / --format=gnu (including -t / --totals
and --common support) as GnuSizePrinter on top of SummarySizePrinter,
sharing radix formatting via printRadixNumber and classifying sections
using SectionRef::isText()/isData()/isBSS() (filtering non-SHF_ALLOC
sections for ELF and debug sections for non-ELF formats such as COFF and
Mach-O).
Assisted-by: Gemini
[offload][OpenMP] Split target_task_privates.c by construct (#247569)
The test added in #245784 fails on the SPIR-V and NVPTX buildbots for
reasons unrelated to that fix: on SPIR-V, clang asserts when emitting
the __kmpc_taskloop call, and on NVPTX, an untied task in a target
region faults at run time. Also, the tests fail on intelgpu for various
reasons.
Move the taskloop and untied task cases into their own tests and mark
all the tests as UNSUPPORTED on the affected targets as a temporary
workaround to unbreak the buildbots.
Claude assisted with this patch.
[SystemZ][z/OS] Define __CHARSET_LIB on z/OS to say programs are ascii (#247841)
When the compiler is generating code ascii it needs to define
`__CHARSET_LIB` to 1 so the system headers use the right variation of
functions like printf.
[ComplexDeinterleaving] Only match complex dot products as single reductions (#242326)
The single-reduction path matched the accumulator and the value added to
it as a complex value, which dropped the accumulation, and it replaced
any final reduction with an add reduction. processReductionSingle is
only correct for a CDot feeding an add reduction, so only accept that.
Fixes #237381.
Fixes #235316.
[lldb] Avoid scanning to the file descriptor limit when launching on FreeBSD (#242022)
Use `close_range()` on FreeBSD to close gaps between preserved
descriptors before exec, avoiding one close syscall per possible
descriptor when procfs is absent. This reduces multi-second launch
delays with large RLIMIT_NOFILE limits to less than 1 second.
Prepare the sorted keep list before fork and preserve the launch-error
pipe and file-action descriptors, including duplication destinations.
Retain the existing cleanup on older FreeBSD SDKs and when close_range
fails at runtime.
[DAG] Combine extract_subvector(scalar_to_vector) -> scalar_to_vector (#247753)
This folds a extract_subvector of a scalar_to_vector to a
scalar_to_vector, providing that the extract is from lane 0.
[llvm-mca][x86] Add SHA512 test coverage (#247233)
Added a new LLVM MCA test for SHA-512 instructions in
llvm/test/tools/llvm-mca/X86/Generic
The test covers the register forms of:
- vsha512msg1
- vsha512msg2
- vsha512rnds2
Enabled SHA-512 through -mattr in the RUN line and generated the
expected checks using update_mca_test_checks.py
Fixes #246307
[CIR][OpenMP] Add support for 'distribute parallel for' with 'target teams'
Adds support for handling the full '[target] teams distribute parallel for'.
Introduces setting the omp.composite attibute for the 'distribute parallel for'
composite construct.
Assisted-by: Cursor / Claude Sonnet 5 High
[CIR][OpenMP] Add initial support for distribute
This patch adds initial support for the OpenMP 'distribute' directive. Basic
code generation for the standalone and combined cases is introduced. Support
for clauses will be added in the future. The composite 'teams distribute
parallel for' form will be added in a subsequent patch.
Assisted-by: Cursor / Claude Sonnet 5 High
[CIR][OpenMP] Add support for omp teams
This patch adds support for the OpenMP 'teams' directive, both standalone
and as the combined `target teams` construct. isCombinableLeaf now also
recognizes teams, so an explicitly-nested `target` + `teams` pair gets
the same omp.combined marking as the combined case.
Assisted-by: Cursor / Claude Sonnet 5 High
[CIR][OpenMP] Add support for OpenMP reduction clause
This patch adds support for the OpenMP reduction clause on the teams and for
directives for reductions with built-in identifiers on local scalar integer and
floating-point variables. Other cases, such as user-defined reductions,
modifiers, arrays and globals, are reported as not yet implemented.
Assisted-by: Cursor / Claude Opus 5.5 Medium
[CIR][OpenMP] Add support for 'distribute parallel for' with 'target teams'
Adds support for handling the full '[target] teams distribute parallel for'.
Introduces setting the omp.composite attibute for the 'distribute parallel for'
composite construct.
Assisted-by: Cursor / Claude Sonnet 5 High