[CIR] Lower __builtin_memcpy/mempcpy to cir.libc.memcpy (#225845)
These previously were lowered to a call to undefined memcpy function
which caused link failures when compiled for AMDGPU since there it is
never resolved to a library function.
cir.libc.memcpy is later lowered to llvm.memcpy intrinsic call which
matches classic codegen.
This also adds alignment attributes to cir.libc.memcpy op so resulting
LLVM IR also has them just like LLVM IR produced by the classic codegen
Assisted by: claude
[AggressiveInstCombine] Bail out on graph nodes in unreachable blocks (#226383)
TruncInstCombine::run() already skips truncs in unreachable blocks, but
the expression graph of reachable trunc can still be extended into an
unreachable block through a phi incoming value. Dead code may contain an
instruction that is its own operand, and buildTruncExpressionGraph only
breaks cycles at phi nodes, so such a cycle leaves the graph unorderable
and ReduceExpressionGraph asks for the reduced value of a node it has
not built yet.
Solution: Bail out as soon as a graph node is found in an unreachable
block, which extends the existing rule from the trunc itself to the
whole graph.
Fixes #58008.
[Support] Remove LongOptionsUseDoubleDash from cl::ParseCommandLineOptions (#226347)
The mode (https://reviews.llvm.org/D61294), in which `-` introduces only
single-character options and `--` long ones, was added for the
binutils-style tools, which have since moved to OptTable. Its last
users, yaml2obj, obj2yaml and split-file, parse with OptTable now.
LLM-aided
[UpdateTestChecks] Escape special characters more consistently (#226203)
The `{{` and `[[` character sequences have special meaning in FileCheck.
Escape these when generating check lines.
We were already doing this for `{{` in analyze tests, where this pattern
occurs e.g. for nested SCEV addrecs. Extend this to `[[`, which occurs
in IR tests due to nested array initializers for globals.
We now need to do this escaping much earlier: `[[...]]` is introduced by
the check line generalization. But even before that, `{{...}}` can be
introduced either via `--replace-value-regex` or via asm scrubbing. So
we perform this escaping right at the start now.
This also updates some AMDGPU LDS tests, which were the motivation for
this change. I've had to manually fix up those check lines one too many
times now...
[TBAA] Only keep the immutable flag if both merged tags have it (#225907)
getMostGenericTBAA() can return one of the two tags unchanged, as it
does when both have the same base type and offset. If only that tag has
the immutable flag, the merged access claims that the memory is constant
on both paths. For example, after SimplifyCFG hoists two such loads, GVN
can forward a load across a store to the same location.
Keep the immutable flag only if both tags have it. Otherwise drop just
the flag and keep the rest of the tag.
[AST] Avoid deprecated implicit `this` capture for C++20; NFC (#226142)
`OpenMPClause.h` contains a lambda with an implicit `this` capture,
which triggers the C++20 deprecation warning in many compilation units
that (transitively) include this header.
[AMDGPU] Add scalar_to_vector pattern for v2bf16 (#225303)
A target DAGCombine rewrites `v2bf16 = scalar_to_vector` into bitcast(any_extend),
but it only runs at -O1 and above, so at -O0 the node reaches ISel and fails to select.
Add the missing pattern, mirroring the v2f16 one, for both fake-true16 and real-true16.
Fixes: ROCM-31415
Orc: Compute the JIT DataLayout from the triple and ABI (#226316)
getDefaultDataLayoutForTarget was constructing a throwaway TargetMachine
purely to read back its cached DataLayout. Directly compute it from
the triple and ABI name instead.
Co-Authored-By: Claude Opus 5 <noreply at anthropic.com>
[mlir][nvgpu] Add negative tests for invalid FP8 warpgroup MMA types (#208047)
Add negative tests for invalid FP8 type combinations in
nvgpu.warpgroup.mma.
FP8 inputs are supported for f16/f32 accumulators, but the verifier
should still reject unsupported combinations such as FP8 accumulators
and mixed FP8/non-FP8 input element types.
Tested:
llvm-lit mlir/test/Dialect/NVGPU/invalid.mlir
[orc-rt] Reorganize regression tests, add JIT'd code support (#226356)
Reorganize orc-rt/test/regression so that tests are placed by the
question they ask, rather than by the kind of input they use:
jit-free-foundations/ Tests of runtime facilities that can be
exercised without JIT'd code: ogre's command
line, process info, logging, and (in future)
connection lifecycle.
languages/<language>/ Tests that source-language constructs behave
correctly when JIT'd under the ORC runtime.
object-formats/<format>/<arch>/
Tests that object format features (e.g.
relocations, sections, and directives) are
handled correctly, written in assembly.
A README.md describes where tests should go, and the conventions for
writing them. Existing tests move into jit-free-foundations/, and
init.test is renamed to ogre-help.test to describe what it tests. The
[35 lines not shown]
[orc-rt] Reject non-socket descriptors in socket:adopt (#226354)
The socket connector now checks with getsockopt(SO_TYPE) that the
descriptor named by a socket:adopt spec is a socket before wrapping it
in a SocketHandle. Non-sockets (pipes, files, etc.) are rejected with an
error and left open. Sockets are claimed after verification so that they
can be closed on error paths (e.g. if GetAttachInfo fails).
Adds SocketConnectorTest.
[lldb] Index Wasm data segment names by their entry's index (#226302)
ParseNames bounds-checked each data segment name entry's index but wrote
the name to the slot of the loop counter. A name subsection with more
entries than segments wrote past the end of the segment vector, and
entries listed out of order named the wrong segment.
rdar://186890690
[libcxx][locale] Refactor strtonum functions using __str_to_float_c_locale<FloatT> (#222081)
Replace the 3 separate functions `__strtof`, `__strtod` and `__strtold`
with a single template `__str_to_float_c_locale<FloatT>` across
locale_base_api and all platform support headers. Since
`__str_to_float_c_locale<FloatT>` now does not need `__get_c_locale`
argument we can directly call it instead of `__do_strtod`.
This removes `__setAndRestore` from `aix.h` entirely as `__locale_guard`
is now used directly in the template specialisations to switch locales.
`num.h` is updated to call `__locale::__str_to_float_c_locale<T>`
uniformly across the 3 separate `__do_strtod` specialisation calls.
Additionally,
- linux.h, bsd_like.h, newlib.h delegate to the platform's native
`strtof_l`/`strtod_l`/`strtold_l`.
- openbsd.h, no_locale/strtonum.h call bare `strtof`, `strtod` and
`strtold` (no locale needed).
- windows.h, locale_win32.cpp's MSVCRT path inlines the 3 functions and
[8 lines not shown]
[RISCV] Remove getInstSizeVerifyMode override (#226241)
Now that we generate the correct instruction sizes for the compressed
instructions we can remove this function override.
[AMDGPU] Apply occupancy-aware register allocation anti-hints (#218074)
This PR overrides applyRegAllocationAntiHints in the SIRegisterInfo so
anti-hints
try to protect against occupancy regression. Changing of the allocation
order is
confined to the vgpr budget of the current occupancy. Reordering is
skipped when
the allocation is near the budget (80% of the target-occupancy vgpr
limit or 95%
of the current occupancy vgpr limit). Below this, the anti-hinted
registers are
moved behind the non-anti-hinted ones within the budget.
## Stack
PR **3/4**. Depends on #218073. Next: Add anti-hints in
GCNPreRAOptimizatioins #218075.
[GlobalISel] Fix segment size when narrowing G_INSERT (#226275)
When an inserted value starts inside a destination piece, bound the
overlap by the size of the inserted value. Including the offset from the
start of the piece can produce an extract wider than its source.
---------
Co-authored-by: Hongyu Chen <hongchen at nvidia.com>
[SandboxVec][LoadStoreVec][NFC] Tighten bundle element types
Use Instruction*/Constant* for LoadStoreVec APIs where that is what
callers hold, and template getCombinedVectorTypeFor so BndlRef is not
forced through a non-covariant Value* conversion.
Co-authored-by: Cursor <cursoragent at cursor.com>
[Support] Remove cl::Grouping (#224958)
This feature emulates POSIX's grouped short options in a non-perfect
way. https://reviews.llvm.org/D61270 made every single-character
cl::option implicitly group, leading to weird error message for `opt
-foo=bar`: `opt: for the -o option: may not occur within a group!`
Every tool (primarily binutils-style tools) has since migrated to
OptTable,
with llvm-cov gcov the last (#224955).
Delete this feature, which would block TableGen based representation.
LLM-aided
[BOLT,test] Add missing pipe in dwarf5-debug-names-skip-forward-decl.s (#226338)
With cl::Grouping, --check-prefix=POSTCHECK parses as -c -h..., so
llvm-dwarfdump prints --help and exits 0, and the checks never run.
[libc++] Run the PR benchmarking tooling from main (#226278)
Previously, we'd use the workflow file and machines.json from the main
branch, but the rest of the tools (e.g. build-at-commit) would be taken
from the PR head. This patch switches to using the tools from main and
only using the PR head's content for the actual code and benchmarks.
This should make it easier to evolve the tools and the workflow files
without breaking PR benchmarking for people who submit PRs from slightly
outdated bases.