[ConstraintElim] Split signed min/max across their operands when checking a compare
The existing constraint systems only record the bounds that hold for both
operands of a min/max (smax(a, b) >= a and >= b, smin(a, b) <= a and <= b). The
other direction is a disjunction, which cannot be recorded as a fact. When a
compare of signed decompositions involves a min/max result, split it into its
operands: the decomposition is monotonic in that result, so it is the max or min
of its values on each side, and the relation holds for all or for either side
respectively.
https://alive2.llvm.org/ce/z/zsGkJ-
[ConstraintElim] Prove sadd/ssub.with.overflow cannot overflow from the exact sum
Decompose the operands and show that the sum lies in the range of the type. This
handles patterns like A + (B - A), as well as sums involving signed min/max
results, which are split across their respective operands using monotonicity
(for example start + smax(end - start - 1, 0) <= end).
https://alive2.llvm.org/ce/z/ze8LCk
[SLP][NFC] Pre-commit tests for compare chains feeding heterogeneous sinks (#240778)
Add tests covering compares that feed a uniform single-use chain whose
sinks are heterogeneous. vectorizeCmpInsts() roots the SLP tree at the
compares, so today only the compares are vectorized and the chain they
feed is left scalar, with one extract per lane.
No functional change.
Co-authored-by: Balakrishna Bandlapalli <bbandlap at gmail.com>
[SLP]Fix bit pack lane cost for interchangeable lanes
A lane like add %x, 0 in the shl node is an interchangeable shl, so
check the op it matches instead of its own opcode.
Fixes #241471
Pull-request: https://github.com/llvm/llvm-project/pull/241485
[lldb][test] Write the Shell tests' lit-lldb-init files from lit (#236887)
The %lldb substitutions source lit-lldb-init-quiet from the test
execution root, and CMake wrote that file and lit-lldb-init into the
build directory. Write them from the lit config instead, when the
substitutions are set up. The test execution root is where lit already
writes test outputs, so this works for any build system that can run lit
with a writable execution root, including ones that cannot add generated
files to it ahead of time, like Bazel.
[X86] combineBasicSADPattern - incorrect vector element count (#240005)
Ensure we determine the vector element count from the reduction ROOT,
not the first vector in the chain - to correctly handle cases where the
ROOT is split during reduction
Fixes #239204
[mlir][vector] Reject `vector.mask` on Xfer ops that have a mask operand (#240797)
`vector.transfer_{read,write}` already have a _mask operand_, so
wrapping them in `vector.mask` gives two ways to express the same thing
and risks double masking. This PR makes `vector.mask` reject a masked
Xfer op that already has a mask operand.
Changes:
- Add a check to `MaskOp::verify` that fails if the op has a mask
operand.
- Add two _negative_ tests for `vector.transfer_{read,write}`.
Part of #239511.
RFC:
https://discourse.llvm.org/t/rfc-unify-masking-in-the-vector-dialect/92675
---------
Signed-off-by: Federico Bruzzone <federico.bruzzone.i at gmail.com>
[GitHub][libc] Bump LLVM to 24 in container image (#241368)
Otherwise we get errors about having an out of date clang (e.g., CMake
error in libc-fullbuild on AMDGPU).
DAG: Remove special case copysign libcall recognition (#241440)
InstCombine already turns this into the copysign intrinsic. There's
also trivially no errno concern contrary to the comment. Clean up
redundant functions where both libcall and intrinsic were tested.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DAG: Remove special case ldexp libcall recognition
InstCombine now turns the eligible cases into the intrinsic.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[AMDGPU] Price misaligned flat and LDS accesses with the LDS misaligned bug
In WGP mode on subtargets with the LDS misaligned bug, a flat access is
split into pieces no wider than its alignment and no narrower than 4
bytes, and an LDS access aligned below 4 bytes uses 8-byte pieces as one
aligned to 4 does.
[AMDGPU] Price buffer fat pointer memory operations (#238842)
Price buffer fat pointer accesses as global accesses, except that an
aligned load is not widened and a vector of odd width elements is not
split element by element. Without relaxed buffer bounds checking, a
vector of elements that are a multiple of 32 bits wide is accessed in
pieces no wider than its alignment and no narrower than 4 bytes, and a
vector of other byte-sized or power of 2 wide elements in pieces of the
largest power of 2 bytes that divides the element size. The width comes
from buffer fat pointer lowering, which now exposes it. When the pointer
is a buffer resource plus a constant offset, the offset and a constant
number of records give the same bounds facts lowering uses to access it
in wider pieces.
Assisted-By: Claude Code Opus 5
[lldb][DWARF] Support standalone line tables (#217932)
Some ELF binaries, including NVIDIA CUDA images, contain `.debug_line`
without `.debug_info`. LLDB currently ignores these standalone line
tables because SymbolFileDWARF only recognizes `.debug_line` when
`.debug_info` is present.
## Summary
- recognize and parse standalone DWARF `.debug_line` sections when
`.debug_info` is absent
- synthesize compile units, line tables, and address ranges for
address-to-source and source-to-address lookup
- Added methods to DWARFDebugLine to parse sequence ranges without
keeping all the rows in memory.
## Testing
- added a one-object SBAPI test for `.debug_line` + `.symtab` without
[5 lines not shown]
Attributor: Collect the values only used by assumes on demand
initializeInformationCache tracked the uses of the operands of every
llvm.assume to find the values only used by assumes, but only a few
abstract attributes and OpenMPOpt ask for them, none of which run in
attributor-light. Collect them for a function when they are first asked
for.
Instruction counts (callgrind) of the light passes in the ThinLTO
backend of tramp3d-v4: -5.8%.
CTMark (-attributor-enable=light): O3 -0.03%, ThinLTO -0.02%.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[CIR] Prune CIR type subtrees when collecting symbol uses (#234811)
applyReplacements builds a symbol user map over the whole module to find
the users of replaced functions, and the generic walk descends into
every nested record of every function signature even though no symbol
reference can hide in a CIR type. Collect only the users of the
functions being replaced, in one pre-order walk that skips CIR type
subtrees, and keep chained replacements working by merging the old users
into the new symbol's set.
On SemaExpr.cpp, applyReplacements drops from 1.7% to 0.4% of compile
samples (perf, cycles).
[mlir][llvm] Add tbaa_struct field attrs to the LLVM dialect (#238991)
The LLVM dialect models `!tbaa` access tags but has no representation
for `!tbaa.struct`, so aggregate copies with struct TBAA lose that
metadata in both directions: export drops it, import warns unhandled
metadata.
This PR adds the missing pieces.
The importer declines nodes it cannot model (null tags, empty nodes)
rather than representing them (warning on unhandled metadata), the
MLIR-side verification of LLVM's non-decreasing-offset rule is left out.
[MemProf][NFC] Standardize on MemPGO terminology and expand docs (#241353)
Documentation, option help strings, header comments, and tests have
referred to LLVM's memory profile-guided optimization framework
inconsistently as "profile guided heap optimization" (PGHO),
"profile-guided memory optimization", and "MemProf". Because the
compiler pipeline optimizes both dynamic heap allocations and static
data layout using profiles from the MemProf instrumentation and runtime,
standardize on "profile-guided memory optimization (MemPGO)" for the
overall optimization framework while reserving "MemProf" for the
profiler, runtime, and profile format.
Updates and expands documentation that was in MemProf.md (now moved to
MemPGO.md with a redirect stub in the old file) to describe more details
about how allocation contexts are classified, the hint values used, and
how matching and LTO whole-program context disambiguation work.
Assisted-by: Gemini
InstCombine: Fold readnone ldexp libcalls to llvm.ldexp
This was already done for the equivalent scalbn.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>