[lld][ELF]: Fix crash when a basic-block sections profile doesn't exist (#226522)
I ran into this crash while linking ONNX Runtime with ThinLTO after
passing a nonexistent path to `--lto-basic-block-sections`. lld reported
that it could not open the profile, but then crashed instead of exiting
with an error.
The failed read leaves `BBSectionsFuncListBuf` null, but `createConfig`
still sets `BBSections` to `List`. The LTO backend then constructs a
basic-block sections profile reader with that null buffer.
This change enables `List` mode only after the profile has been read
successfully, leaving the existing error reporting in place.
The regression test uses a minimal `_start` definition and a nonexistent
profile path to cover both full LTO and ThinLTO.
AI assistance: LLM-aided investigation and testing
[flang] Trust the lowering symbol table in the FirOpBuilder lookups (#232678)
Lowering's `FirOpBuilder::getNamedGlobal` / `getNamedFunction` (and
`fir::createFuncOp`, `createGlobalOp`, `lookupTypeInfoOp`) fall back to
a linear `ModuleOp::lookupSymbol` walk whenever the bridge's
`mlir::SymbolTable` misses, and every new global is a miss. For a unit
that reaches N derived types (about 25 `linkonce_odr` type-info globals
each), lowering walks the module once per global: O(N^2) again, after
#232555 removed the larger codegen term.
The fallback existed because the table was not complete:
`fir::createFuncOp` took it by const pointer and never inserted the
function it created, so every runtime, intrinsic and procedure
declaration bypassed it, and three sites in OpenACC/OpenMP lowering
created `func.func` directly. This PR makes the table complete (creation
helpers insert what they create; the direct creations register through a
new `fir::registerSymbol`, which never renames on a clash; the sham
function of `createBuilderOutsideOfFuncOpAndDo` is erased through the
table) and then lets the lookups trust it. Under `EXPENSIVE_CHECKS`
[3 lines not shown]
[AArch64][llvm] Combine SVE AND-NOT operations into BIC for _x forms (#232526)
Replace `not` followed by `and` with `bic` for expressions such as:
```
return svand_u32_x(svptrue_b32(), a, svnot_u32_x(svptrue_b32(), b));
```
Combine ordinary `and` with `not` when the `not` predicate is all-active
or its inactive values are undefined.
Also combine matching-predicate SVE `and_x`-`not` pairs before lowering
discards the `and` predicate. `and_x` ignores inactive results, so the
`not`'s inactive values do not need preserving.
This applies to all integer element widths. Update the pre-commit LLVM
expectations, including cases where combining would change the
result.
[AArch64][llvm] Combine SVE AND-NOT operations into BIC for _m forms (#232527)
Replace `not` followed by merging `and` with `bic` for expressions such
as:
```
return svand_u32_m(pg, a, svnot_u32_x(pg, b));
```
Combine when `not` is the second operand and its predicate matches the
`and` predicate or is all-active.
Use predicated `bic` to preserve the `and`'s first operand in inactive
lanes. Use unpredicated `bic` when the `and` predicate is all-active.
Do not commute merging `and` operands, since this would change inactive
results. Leave pairs with incompatible predicates unchanged.
This applies to all integer element widths. Update the pre-commit LLVM
expectations, including cases where combining would change the
result.
[AArch64][llvm] NFC: Add pre-commit tests for SVE AND-NOT combining (#232525)
Add LLVM tests for expressions where NOT followed by AND could
use BIC. Record the existing assembly so the following changes show the
missed optimisations being fixed.
Cover _x and _m AND forms using all-active and runtime predicates. Test
_m forms across all integer element widths. Include NOT with defined
inactive values and reversed AND operands.
Also test cases that must remain as NOT followed by AND because
combining would change the values in inactive lanes.
[InlineFunction] Simplify lifetime intrinsic check (NFC) (#235681)
The pointer type check always passes since the opaque pointers
migration. Additionally, we nowadays require that lifetime
intrinsics are direct users of the alloca.
locate.1: clarify bytes vs. characters
The database stores bytes, not characters. Remove the historical
note about 7-bit storage. Also document that -i ignores case only
for ASCII letters.
Reviewed by: ziaee
MFC after: 3 days
(cherry picked from commit a03b051f238eb78cfccbe834b0cc206e66d566e5)
find.1: rewrite the -s flag section for clarity
Restructure the description of -s flag:
1. what the option does
2. why it is useful (deterministic order, streaming output)
3. how its results can differ from `find | sort'
Reviewed by: ziaee
MFC after: 3 days
(cherry picked from commit ad0f86694157c998fec500e9a553550976cbc100)
[AArch64] Support FP atomic stores with memory hints
This patch extends the atomic-store-hint pseudos to accept preserved
floating-point atomic stores. It adds an FPR16 pseudo family and direct
half, bfloat, float, and double patterns for the supported addressing
modes.
The pseudos expand relaxed stores to STR and RCPC3 release and
sequentially consistent stores to STLUR, retaining memory hints without
cross-register-bank copies.
The existing AArch64::ATOMIC_STORE_HINT_H is renamed to
AArch64::ATOMIC_STORE_HINT_HH and AArch64::ATOMIC_STORE_HINT_H now means
FP16 instead of it's old association with integer half-word.
find.1: fix rendering of find -s example
The period here is part of the literal string in the example. Adding a
space caused the example to be quoted wrongly. Instead, a trailing
zero-width space keeps the linter mandoc -T happy.
Reviewed by: ziaee
Differential Revision: https://reviews.freebsd.org/D59353
(cherry picked from commit 3581b6db62b1a2146014b3196f18bde3fc33010d)
[AArch64] Support direct RCPC3 FP atomic loads and stores
Preserve half, bfloat, float, and double atomic loads and stores
through AtomicExpand for acquire and release orderings, and preserve
sequentially consistent stores, when RCPC3 and NEON are available.
Add SelectionDAG patterns for the RCPC3 LDAPUR and STLUR operations,
including unscaled offsets, and update the existing FP lane patterns to
match the preserved floating-point atomic nodes. Targets without the
required features continue to use integer lowering.
[AArch64] Support direct relaxed FP atomic loads and stores
This patch preserves half, bfloat, float, and double atomic loads and
stores through AtomicExpand when they use unordered or monotonic
ordering and the target supports floating point.
It adds SelectionDAG patterns that select the accesses directly in the
floating-point register bank. Unsupported targets, stronger orderings,
and stores carrying memory hints continue to use integer lowering but
will be handled in the subsequent PRs.
[SLP] NFC: make candidate state ownership explicit
Separate the state for the currently owned SLP graph from the graph state
used by dependency analysis, costing and emission. Keep these in private
CandidateState and SharedGraphState members of BoUpSLP.
Centralize candidate reset after scheduler invalidation, clear shared
observers before destroying graph entries, and verify ownership under
EXPENSIVE_CHECKS. Preserve existing reset boundaries and vectorization
behavior.
Assisted-by: codex
[libc] Use a syscall wrapper for `epoll_create1` (#234907)
This PR move `epoll_create1` behind the centralized syscall wrappers,
following `libc/docs/dev/syscall_wrapper_refactor.md`.
editors/vis-editor: import vis-editor-0.9
Packaged for wip by arcathrax, Manuel Kuklinski, pin, leot, Silas, and
Eric Garver.
Vis aims to be a modern, legacy free, simple yet efficient vim-like editor.
The intention is not to be bug for bug compatible with vim, instead a similar
editing experience should be provided. The goal could thus be summarized as
"80% of vim's features implemented in roughly 1% of the code".
[analyzer] Remove questionable assertions in tryRearrange (#234624)
The `tryRearrange` logic in `SimpleSValBuilder.cpp` has asserted that if
a `SymIntExpr` reaches this point (as an operand of the expression that
is being rearranged), then its RHS (a concrete `APSInt`) has the same
type as the symbolic LHS.
This commit replaces these assertions with a defensive early return.
I did not observe any failure of these assertions; tests in
`svalbuilder-rearrange-comparisons.cpp` validate that they are not
triggered by some natural candidates, e.g. handling `x - 1U` where `x`
is a symbolic integer.
However, this is not a general invariant of all `SymIntExpr` instances
(there are 50+ LIT tests where one argument of `evalBinOpNN` is a
`SymIntExpr` where the types of the LHS and RHS are different) and there
isn't any concrete reason that would filter out mixed-type `SymIntExpr`s
before the `tryRearrange` logic, so the assertion isn't justified.
[12 lines not shown]
[NFC][analyzer] Replace `CheckerContext::generateSink` with `addSink` (#234351)
This change generalizes `addSink` to match the signature and behavior of
`generateSink` (but with comfortable default values for all three
parameters), then replaces use of `generateSink` with `addSink` and
deletes `generateSink`. Textually replacing `generateSink` with
`addSink` is a correct way to update downstream checkers; but it is
often possible to remove arguments that were mandatory for
`generateSink` but match the defaults of `addSink`.
This change was motivated by the fact that `CheckerContext` had three
sink-making methods (`generateSink`, `addSink` and `generateErrorNode`)
which all do the same thing and cause lots of confusion with their
separate existence. They all had their advantages and drawbacks:
- `generateErrorNode` is the most widespread (85 uses in checkers), but
it cannot be THE sink-making function, because the name is not suitable
for the dozens of cases where the sink is not used for an "error" (bug
report). It also creates the unfortunate illusion that "error nodes" are
somehow different from regular nodes.
[17 lines not shown]