[AArch64] Mark masked load/store data types that get legalized to scalars illegal (#228122)
Masked load/stores cannot handle data types that get scalarized during
type legalization. This PR marks them illegal in AArch64 TTI so they get
expanded before reaching SDAG.
Fixes e.g. the crash:
```llvm
; llc -mtriple=aarch64 -mattr=+sve crash.ll
define <1 x half> @masked_load_v1f16(ptr %p, <1 x i1> %mask) vscale_range(2,2) {
%load = call <1 x half> @llvm.masked.load.v1f16.p0(ptr %p, <1 x i1> %mask, <1 x half> poison)
ret <1 x half> %load
}
```
MC: Make usesWindowsCFI a pure object-format predicate
Whether unwind information is encoded with SEH opcodes (.seh_*, .pdata
and .xdata) is a property of the object format. Whether a function uses
that encoding depends on the exception model, but usesWindowsCFI()
conflated the two. Make it report only the format, and add
MachineFunction::usesWindowsUnwindInfo() for the combined question and
needsWinCFI() for the common case that also requires an unwind table
entry.
This moves the exception model check to the point of use, in preparation
for removing ExceptionModel from TargetOptions. The assembler now accepts
.seh_* directives whenever the object format supports them (i.e., MC
only tools will no longer have a notion of ExceptionModel).
Co-authored-by: Claude Opus <noreply at anthropic.com>
[clang][CIR] Add tests for SVE MAXV intrinsics (#230080)
adds CIR tests for svmaxv (plain SVE) intrinsics.
Moves and adapts sve-intrinsics/acle_sve_maxv.c to sve/maxv.c.
Part of #223963
[clang][CIR] Add tests for SVE EORV intrinsics (#230083)
adds CIR tests for sveorv (plain SVE) intrinsics.
Moves and adapts sve-intrinsics/acle_sve_eorv.c to sve/eorv.c.
Part of #223963
TableGen: Cache resolved class instantiations
The same class instantiation is often referenced many times in one
record, and each reference was resolved again from scratch along with
everything nested in its arguments. Cache the results in MapResolver and
RecordResolver. The cache is cleared when the mappings change, and is
bypassed while a mapped variable is being resolved.
Nested instantiations are resolved through a TrackUnresolvedResolver,
which does not change the result. These share the cache of the
underlying resolver, which also records whether any references were left
unresolved so the trackers can be updated on a hit.
Gigainstructions executed by llvm-tblgen --null-backend
before after
AMDGPU.td 71.75 18.22 -74.6%
X86.td 6.10 6.15 +0.8%
AArch64.td 3.28 3.32 +1.3%
[3 lines not shown]
TableGen: Skip resolving values that cannot change
Lists, dags, bits and arguments made only of leaf values always resolve
to themselves, but resolving them still walked every element. Record
this when they are created and return early.
Gigainstructions executed by llvm-tblgen --null-backend
before after
AMDGPU.td 79.12 71.73 -9.3%
X86.td 6.25 6.12 -2.1%
AArch64.td 3.40 3.28 -3.7%
RISCV.td 8.34 8.19 -1.8%
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
TableGen: Use DenseMap for the IntInit pool
Gigainstructions executed by llvm-tblgen --null-backend
before after
AMDGPU.td 79.34 79.13 -0.3%
X86.td 6.30 6.25 -0.7%
AArch64.td 3.43 3.41 -0.6%
RISCV.td 8.40 8.34 -0.7%
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[mlir][acc] Report independent loops not parallelized due to unstructured control flow (#230066)
An independent acc loop whose body has unstructured control flow (for
example a backward GOTO) cannot be represented as a structured loop, so
it is executed sequentially. This happened silently: no remark was
emitted for the loop, and the user only saw a serial kernel without a
reason.
Emit a remark for such loops stating that they are not parallelized
because their control flow could not be represented as a structured
loop. This lets users identify loops that are asserted parallel but run
sequentially.
Co-Authored-By: Claude
[clang][CUDA] Perform lvalue-to-rvalue conversion on `__cluster_dims__` attribute arguments (#227998)
A `ConstantExpr` with an lvalue subexpression should always have an
lvalue APValue result.
[libc] Fail configure if requested linting cannot run (#231001)
If linting was requested but could not run, CMake previously disabled it
with a warning and generated an empty libc-lint target.
Change these conditions to FATAL_ERROR so misconfigurations fail early:
* Compiler is not Clang
* clang-tidy is not found
* Auto-discovered clang-tidy has a mismatched major version
If LLVM_LIBC_CLANG_TIDY is set explicitly, treat version mismatches as a
warning instead of an error.
Document the configure requirements in code_style.md.
Assisted-by: Automated tooling, human reviewed.
[clang][NVPTX] Emit !atomic.ignore.denormal.mode for CUDA atomics (#217587)
CUDA's atomicAdd() family is defined in terms of PTX atom.add, whose
denormal behavior is fixed by the hardware. Without any annotation the
backend has to assume the function's denormal mode must be honored and
expands these into CAS loops whenever the two disagree. Mark them with
!atomic.ignore.denormal.mode so the native instruction is used.
That covers the __nvvm_atom_*_add_gen_f builtins that atomicAdd(),
atomicAdd_block() and atomicAdd_system() are written in terms of, plus
C11/C++11 atomics under -fatomic-ignore-denormal-mode and the
[[clang::atomic(ignore_denormal_mode)]] attribute, which requires
teaching the NVPTX target about AtomicOptions.
The condition for when the metadata is meaningful is now shared with the
AMDGPU and SPIR-V targets in addAtomicIgnoreDenormalModeMetadata(). It
takes an AllowHalf flag because whether f16 denormals are observable is
target specific: PTX exposes no FTZ control for f16 operations, so
atom.add.f16 never flushes and the opt-in is meaningful there, whereas
[4 lines not shown]
[BranchFolding] Ignore debug instructions in singleton cond branch check (#228715)
DBG_VALUE was counted when checking for a single-branch block, so the
duplicate branch was kept only under -g.
Fixes #228713
Assisted-by: Claude Opus 5.5
[mlir][RemoveDeadValues] Replace dead function argument uses with poison (#208881)
Dropping all uses of a dead function argument can leave null operands in
surviving side-effecting operations in unreachable code.
Subsequent canonicalization may then crash while folding the invalid
operation.
This PR replaces the remaining uses with `ub.poison` before erasing the
argument and add a regression test.
Fixes #206920, fixes #203226
[MLIR] Guard against overflow when simplifying affine expressions. (#228010)
Fixes https://github.com/llvm/llvm-project/issues/224577.
Current canonicalizer may lead to signed integer overflow while
simplifying affine expressions. This change adds overflow checks and
returns `failure()` when an overflow is detected.
[test][llvm-ar] Restore file permissions in error-opening-permission.test (#230361)
error-opening-permission.test sets chmod 100 on %t/permission.b to test
EACCES handling, leaving an unreadable file in the build directory after
the test finishes. This causes permission errors for tools like rsync
when copying the build directory.
Restore permissions with chmod 700 at the end of the test, matching
llvm/test/tools/llvm-ranlib/error-opening-permission.test.
Assisted-by: Gemini
[clang][CIR] Add tests for SVE ORV intrinsics (#230082)
adds CIR tests for svorv (plain SVE) intrinsics.
Moves and adapts sve-intrinsics/acle_sve_orv.c to sve/orv.c.
Part of #223963