RuntimeLibcalls: Mark noreturn and pure helper libcalls (#241627)
Mark the functions which never return as noreturn. Add some nounwind
and cold, mostly following inferLibFuncAttributes. Mark
misc. functions as pure.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
contrib/kyua: update config.h for 0.15.1 -> 0.15.2
This was accidentally missed in the prior commit.
This commit addresses a largely cosmetic issue.
MFC after: 6 days
MFC with: c16da33701d0
Fixes: c16da33701d0 contrib/kyua: update to 0.15.2
[X86][APX] Test the relocation of an NF add
test_regclass_not_updated_by_regalloc_2 only produced an NDD/NF add
with a GOT operand because the allocator happened to give the add a
destination different from its source. With SlotIndexes compaction it
picks the same register, so the add is compressed to the legacy form
and the CODE_6 TODO lost its test.
Add a function whose add keeps its source live, so it stays NDD and
becomes NF under any allocation.
[X86] Enable SlotIndexes compaction by default
Compacting SlotIndexes before greedy allocation drops the entries of
erased instructions, so live range sizes and instruction distances
reflect the code being allocated rather than how much was erased
before it. AMDGPU has done this since #235806; do the same for X86.
Codegen changes only through allocation: no new crashes, verifier
errors or allocation failures in the lit suites, including
EXPENSIVE_CHECKS, and a stage-2 build of LLVM, clang and lld with
-verify-machineinstrs passes its own tests. On llvm-test-suite at -O3,
spills drop 0.3% and .text 0.06%, with compile time unchanged.
Most test updates are regenerated checks. misched-matmul now inserts
20 spills instead of 24. live-debug-vars-stale-slotindexes.mir gets
one more use of %27 so that accumulate_fit still reaches the stale
index path it was written for.
[AArch64] Avoid folding SRA/SRL into ALU when it can be folded with SHL/AND (#234737)
For the following function
```
int f(int a, int b) {
b -= (a<<26)>>29;
return b;
}
```
LLVM currently generates
```
f:
lsl w8, w0, #26
sub w0, w1, w8, asr #29
ret
```
However, if we don't fold the `asr` into the `sub`, the `asr` can be
folded with the `lsl` instead, and we can avoid generating the
[10 lines not shown]
etc: run the sub-makes with the source tree's mk files
Pass -m ${.CURDIR}/../share/mk through .MAKEFLAGS, so the sub-makes
use the mk files from this source tree, as the top-level Makefile
already does for preinstall and upgrade, and nrelease does for
distribution.
Reviewed-by: @aly
Remove {ATF,PLAIN}_REQUIRE_KERNEL_MODULE macros
These macros predated the `require.kmod` (ATF) and `required_kmods`
(kyua) test metadata and are no longer needed.
Add a hint to freebsd_test_suite/macros.h about the `*FEATURE*` macros
going away soon. See [this kyua issue][kyua-issue] for more details.
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D61082
[kyua-issue]: https://github.com/freebsd/kyua/issues/346
Remove {ATF,PLAIN}_REQUIRE_KERNEL_MODULE macros
These macros predated the `require.kmod` (ATF) and `required_kmods`
(kyua) test metadata and are no longer needed.
Add a hint to freebsd_test_suite/macros.h about the `*FEATURE*` macros
going away soon. See [this kyua issue][kyua-issue] for more details.
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D61082
[kyua-issue]: https://github.com/freebsd/kyua/issues/346
[clang] fixup -Wunused-private-field (#244427)
-Wunused-private-field will soon be able to flag fields in instantiated
class templates. Land this in preparation.
Link: #237374
Link: #244396
RegisterCoalescer: Drop unused value numbers after joining
Erasing a pruned IMPLICIT_DEF marks its value number unused but leaves
it in NewVNInfo, and LiveRange::join only skipped null entries, so the
joined range kept a dead value number. Skip unused entries in join and
size valnos to the number actually kept. pruneSubRegValues similarly
only marked the pruned subrange value unused, so remove it instead.
The resulting live intervals now will have the same value numbers as a
fresh LiveIntervals computation.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
RuntimeLibcalls: Add attributes to fenv libcalls
Treat the fp environment as inaccessible memory.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
FreeBSD: Fix append-only semantics
On FreeBSD, ZFS_APPENDONLY was only enforced on the write path, so an
append-only file could still be truncated or extended with ftruncate(2)
through an O_APPEND descriptor, hole-punched with fspacectl(2), have its
mode changed, and be removed or renamed. Entries of an append-only
directory could also be removed or renamed. In summary:
- zfs_setattr(): apply the ZFS_IMMUTABLE attribute restrictions, which
include size changes, to ZFS_APPENDONLY files as well.
- zfs_deallocate(): refuse immutable and append-only files.
- zfs_zaccess_delete(): refuse append-only files and entries of
append-only directories, which also covers rename.
Add ZTS coverage. Linux already refuses these operations in its VFS,
so the tests are common.
zfs_clone_range() only refused ZFS_IMMUTABLE destinations. On FreeBSD,
O_APPEND can be cleared with F_SETFL after opening an append-only file,
[12 lines not shown]
[TTI] Return zero when query getRegUsageForType() with invalid type. (#243811)
This patch makes `getRegUsageForType()` returns 0 when the type is
invalid.
With this changes, we can remove the type legalization check for
scalable vector (`isElementTypeLegalForScalableVector()`) in the
VPlan-based register model. This allows `i1` scalable vector for RISC-V
can be calculated.
The reason that we don't want to accept `i1` in the
`isElementTypeLegalForScalableVector()` in RISC-V is because this
function also being used to decide if the loop can be scalable
vectorized and RISC-V don't support scalable `i1` vector load/store.
This patch partially fixes
https://github.com/llvm/llvm-project/issues/243706.
The register spill count is close to the generated assembly.
Pruned the test case with AI assistance.
[libc] Fix strtof128_test and GPU shared str_to_float build failures (#244436)
Fix two post-merge buildbot failures after #243955:
1. Define the fallback `float128` alias in `strtof128_test.cpp` when
`LIBC_TYPES_HAS_NATIVE_FLOAT128` is not set (e.g. Clang < 18.1 on
x86_64).
2. Avoid pulling `FPUtil/float128.h` (and transitively `FEnvImpl.h`)
into `str_to_float.h` by turning `ClingerConsts<fputil::Float128>` into
a dependent partial specialization, and undefine
`LIBC_MATH_USE_SYSTEM_FENV` on `LIBC_TARGET_ARCH_IS_GPU` in `FEnvImpl.h`
since GPU targets do not provide system `<fenv.h>` functions.
Also clean up direct includes and sync CMake and Bazel dependencies.
Assisted-by: Gemini
RuntimeLibcalls: Add attributes to libc libcalls
Annotate C library functions with the attributes InferFunctionAttrs
gives. This isn't fully captured in the DeclareRuntimeLibcalls testing
because not all of these functions are yet associated with a library.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
RuntimeLibcalls: Add attributes to target memory helper libcalls
Annotate the various target specific memcpy-like functions with known
alignments.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
RuntimeLibcalls: Mark noreturn and pure helper libcalls
Mark the functions which never return as noreturn. Add some nounwind
and cold, mostly following inferLibFuncAttributes. Mark
misc. functions as pure.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
RuntimeLibcalls: Add attributes inferLibFuncAttributes gives libcalls (#241618)
Remove more differences with the attributes the InferFunctionAttrs
pass would add to the declared libcalls.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>