[SCEV] Look for guard conditions through merge blocks. (#228135)
Update LoopGuards::collectFromBlock to continue past single predecessor
chains by traversing further through the immediate dominator chain.
This improves results in a large number of cases
https://github.com/dtcxzyw/llvm-opt-benchmark-nightly/pull/1548 and
recovers most of the regression we saw from improved
ConstraintElimination (removing a redundant branch in the
single-predecessor chain via a fact from another dominating check).
This increases compile-time slightly (partly due to additional work in
SCEV, partly because additional transformations), but I think in this
case
the increase is warranted by the benefits.
stage1-O3: +0.04%
stage1-ReleaseThinLTO: +0.04%
stage1-ReleaseLTO-g: +0.04%
[7 lines not shown]
[opt] Use StringSet to catch duplicated opts in passRegistered (NFC) (#234670)
Replace the linear scan in passRegistered with StringSet lookup. This
makes registering passes linear instead of quadratic: for each
registered pass (~600) we scanned all options.
This improves opt startup time, depending on the input size and time
spent in opt. For median bitcode module in CTMark (31.6 kb), end-to-end
opt -O3 executed instructions reduces by ~4%.
Aided by Opus 5.5
PR: https://github.com/llvm/llvm-project/pull/234670
[libc][math] Optimize exp and share double-precision evaluation with exp2.
Refactor double-precision exp to share most of the computations with exp2,
and adding support for `LIBC_MATH_HAS_SMALL_TABLES` and
`LIBC_MATH_HAS_SKIP_ACCURATE_PASS`.
Assisted by: Gemini is used for performance and code size analysis and refactoring.
IR: Add attributes from an array to an attribute set (#234240)
Add AttributeSet::addAttributes and AttributeList::addAttributesAtIndex
overloads taking an array of attributes sorted like an attribute set,
with distinct kinds. They merge the attributes into the set in one pass,
without first copying the set into an AttrBuilder and adding each
attribute to it.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[AArch64] Better bitcast costs. (#227354)
A bitcast between different register banks is essentially the same as a
vector lane insert/extract, and should be costed the same as a
cross-regbank copy. Between the same regbank it is free (outside of BE,
which this does not try to handle, and bitcasts that need packing for
which this is better than the existing fallback of 1 but isn't very
accurate yet).
abi: updates for removed atomic_* and member_* exports
Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Kamil Monicz <kamil at monicz.dev>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #19518
config: test for atomic intrinsics and -latomic
Test for 64-bit atomic support in the compiler, either directly or via
-latomic. If required, -latomic is added to the global LIBS, and all
programs will be linked against it.
The previous version of this check tried to compile lib/libspl/atomic.c
directly. That's now gone so this needed an update anyway.
All GCC and Clang that have C11 support have these intrinsics, and use
them to implement stdatomic and _Atomic. However, they are not part of
any standard, and a C11 compiler is not required to implement them.
It's extremely unlikely that we'll ever encounter this situation, but if
we do this check will fail, and we can implement atomics some other way.
libatomic is a GCC implementation detail, so there's no guarantee that a
non-GCC compiler that doesn't implement atomic intrinsics internally
will necessarily supply a libatomic that does, but that's the common
method when it is necessary. Again, if a compiler implements it support
[25 lines not shown]
[flang-rt] Fix MOD/MODULO for REAL operands of magnitude 2**63 (#229895)
`RealMod()`'s integer fast path converts both operands to std::int64_t,
guarded by
```c++
aAbs <= static_cast<T>(std::numeric_limits<std::int64_t>::max())
```
In float and double, `INT64_MAX` is not representable and the cast
rounds up to `2**63`, so operands of magnitude exactly `2**63` (one past
the end of the `std::int64_t` range) reach the fast path. Both signs go
wrong there:
* `-2**63` converts exactly to `INT64_MIN`, and `MOD(-2**63, -1.0)` then
evaluates `INT64_MIN / -1`, which overflows. On x86_64 that is an idiv
trap, so the program dies with SIGFPE.
* `+2**63` is out of range for the conversion, which is undefined
[20 lines not shown]
libspl/atomic: extend generators for pointer variants
Use selector macros to handle void as a void* parameter and void**
target as necessary. This lets us generate the pointer variants from the
same implementations rather than repeating ourselves.
Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Kamil Monicz <kamil at monicz.dev>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #19518
libspl/atomic: use intrinsics for load/store
Volatile accesses are ordered within the same thread (C11 §5.1.2.3),
however they are not atomic (concurrent read & write is a data race) and
are not barriers against non-volatile accesses (C11 §5.1.2.4).
They also aren't easily interceptable by static analysis or sanitizer
tools, because they're a special language feature, rather than just
another intrinsic.
Let's just sidestep all of this, and use atomic intrinsics for load and
store. In production builds they will decompose to the same assembly
instructions anyway, and for anything else they're much easier to work
with.
Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Kamil Monicz <kamil at monicz.dev>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #19518
libspl/atomic: lift implementation into header as inlines
Best of both worlds - compiler can aggressively inline the intrinsic,
but they're also named so can be #define'd over, seen in the debugger on
low-optimisation builds, etc.
Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Kamil Monicz <kamil at monicz.dev>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #19518
libspl: move atomic.h to sys/atomic.h
Matches the kernel SPLs.
Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Kamil Monicz <kamil at monicz.dev>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #19518
[libc++] Add a tool to select commits to narrow down benchmark changes (#234716)
This patch adds the select-refinement-commits script, which reads
changepoints and ranks them. It then selects the commits in the middle
of the segments containing changes, i.e. it selects the commits that we
should measure in order to bisect the high-ranked changes we detected.
By then requesting these additional data points from the benchmarking
infrastructure, this allows dynamically refining the benchmark data we
have to pinpoint regressions exactly at the commit that introduced them.
This script is biased towards prefering large changes on a few
benchmarks over small changes over many benchmarks, whicih fits the
nature of libc++ benchmarks better and was experimentally observed to
produce better decisions. This may not be right for other test suites.
The output of the script is a commit list meant to be included with the
benchmark planning pipeline.
Assisted by Claude
[AMDGPU] Update lower-control-flow-live-variables-update.mir checks (#234705)
#234197 stopped AMDGPU passes from adding kill flags on virtual
registers, but #234174 had just updated this test to expect them, and
the two changes landed independently. The test has been failing on main
since #234197 merged, as noted in the review comments there.
Regenerate the checks with `update_mir_test_checks.py`. The only change
is dropping `killed` from the `S_MOV_B64_term` of the `S_AND_B64` result
in the four checked functions.
ports-mgmt/optique: New port: Fast ports options configurator for poudriere, synth and local builds
optique reviews and maintains ports OPTIONS files for poudriere, synth or
local builds: it resolves a package list's whole dependency closure in
parallel, reading the options directory, make.conf layers and blacklist
the build would use, shows every port in one TUI with those needing a
decision first, and writes every options file atomically on apply.
scan, sync, decide and clean cover scripting and cron.
WWW: https://github.com/sdalu/optique
Co-authored-by: Michael Osipov <michaelo at FreeBSD.org>
PR: 299700
[LLDB] Initial swift debugserver bringup (#233593)
This commit breaks ground on the swift rewrite of debugserver. I am
choosing to start with the driver so we can immediately have an
executable to run and integrate into LLDB earlier rather than later. The
main purpose of this initial commit is to make sure that the build
system is ready and capable of building swift executables, though I'm
sure we'll uncover more issues as we add more functionality.
The new debugserver will support a GDB-Remote mode and a Platform mode
much like lldb-server already does. In terms of command line interface,
it will have top-level commands to specify which mode to operate with.
Currently the binary only prints the version (which I have hardcoded).
Later commits will fill this in with a version matching the LLDB it
ships with.
RFC:
https://discourse.llvm.org/t/rfc-rewriting-debugserver-in-swift/92424/9
[clang] Reland clang-cl option normalization (#234597)
Reland #228096, which makes clang-cl optimization, macro, and
`/permissive`
options work consistently for host and device compilation.
The original change was reverted in #234563 because a preprocessing test
used an x86 target on AArch64-only builds. The test now uses the
configured
target. The compiler code is unchanged from the original change.
The original test fails and the fixed test passes with an AArch64-only
compiler. The focused tests and full Driver suite pass.
vdev: atomically account checkpoint space during parallel load
Each vdev_load task adds its checkpoint space to the same pool-wide
sci_dspace counter. Plain updates can lose contributions from other
vdevs loading concurrently. Use atomic addition during load and
atomic subtraction when tearing down a loaded checkpoint space map.
The other updates of the counter, in metaslab_sync() and in the
checkpoint discard callback, are not known to race, but use the same
atomic helpers so that every update of the field is consistent.
This addresses a candidate cause of the sci_dspace verification
failure in #12053; that failure has not been reproduced locally.
Sponsored-by: TAKT (ABX DEVELOPMENT LLP)
Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Dmitry R <rdmitry0911 at gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[2 lines not shown]
[OptBisect] Add function filtering support to opt-bisect (#222123)
Add support to restrict the behavior of opt-bisect to only the functions
passed to `-opt-bisect-funcs`. Added a lit test to check the verbose
output using the new flags.
[RISCV] Account for Libcall spill size in RVV Offsets (#234395)
We were not calculating and storing the libcall spill size early enough
to take account of it when calculating frame offsets for RVV objects.
The libcall spill size is accounted for separately to the push/pop size
and any interrupt spill size.
Now we calculate the libcall spill size earlier and save it in the
RISCVMachineFunctionInfo, so all later calls to `getReservedSpillsSize`
will include it, as intended, including those done in
`getFrameIndexReference` (which were missing it before).
Assisted-by: AI