[lldb][CMake] Link static libraries before liblldb (#235949)
The static linker resolves each undefined symbol from the first library
on the command line that defines it. When liblldb re-exports private
symbols, for example with LLDB_ENABLE_DYNAMIC_SCRIPTINTERPRETERS, tools
that list liblldb before lldbHost and lldbUtility bind part of those
libraries to liblldb and the rest to their own static copies.
List liblldb last so the static libraries take precedence. On Linux,
`lldb_prevent_liblldb_symbol_interposition` already covers this with
--exclude-libs.
[ci] Create a monorepo-wide workflow to submit to LNT (#235863)
Lift the libc++ specific workflow into one that is clearly decoupled
from libc++ and can be reused by other projects in the monorepo. This is
intended to support other projects submitting data into LNT.
One interesting question is whether we want all jobs to use the same
token. In LNT v5, a token can be scoped to specific test suites (e.g. a
token can be limited to submitting only to the libcxx test suite). Right
now, this workflow assumes that the token in use can submit to the
provided suite, and all submissions would use the same token, which
would be unscoped.
I think this is fine, at least for now, but we could potentially revisit
this decision in the future.
[mlir][math] Add a set-llvm-linkage option to convert-math-to-funcs (#235961)
`--convert-math-to-funcs` adds a `llvm.linkage` attribute to each
generated function (which is consumed by FuncToLLVM), but this breaks
other pipelines, such as FuncToEmitC, since `mlir-translate
--mlir-to-cpp` registers only the cf, emitc and func dialects (but not
llvm) so
```
mlir-opt --convert-math-to-funcs --convert-arith-to-emitc --convert-func-to-emitc in.mlir \
| mlir-translate --mlir-to-cpp --declare-variables-at-top
```
fails on, e.g., `math.ipowi` with "#llvm.linkage<...> attribute created
with unregistered dialect".
This adds a `set-llvm-linkage` option to `--convert-math-to-funcs`
(default on) and leaves the attribute off when the flag is set to off.
[WebAssembly] Fix Analysis Preservation for GISel Passes (#235960)
These are preserved by the LegacyPM so also mark them as preserved by
the NewPM versions.
[lldb] Don't link DWARFUnit to print DWARF expressions (#229798)
`DWARFExpression::DumpLocation` and `UnwindPlan` pass a null `DWARFUnit`
to `llvm::printDwarfExpression`, and `DWARFExpressionList` prints
addresses with `DWARFFormValue::dumpAddress`. Both link `DWARFUnit` and
`DWARFContext`, which pull in every object file reader and `LLVMCore`.
Use the `printDwarfExpression` overload that takes no unit, and format
the addresses with `format_hex`, which produces the same output.
[mlir][emitc] Lower remaining C99 <math.h> functions in MathToEmitC (#235950)
`MathToEmitC` was missing lowerings for many `math` ops that C99/C++11
provide as <math.h>/<cmath> functions.
This adds call patterns for `tan`, `atan`, `sinh`, `cosh`, `tanh`,
`asinh`, `acosh`, `atanh`, `exp2`, `expm1`, `log`, `log2`, `log10`,
`log1p`, `cbrt`, `erf`, `erfc`, `trunc`, `copysign` and `fma`, following
the existing patterns. It also lowers `isnan`, `isinf`, `isfinite` and
`isnormal` to the macros of the same name.
Same as for the existing ops/lowerings, fastmath flags are dropped and
since the <math.h> functions use the dynamic rounding mode, ops with a
static rounding mode are also not lowered.
This still isn't full coverage of `math`. `--math-expand-ops` can
rewrite `rsqrt`, `clampf`, `fpowi` and `ctlz`, which have no <math.h>
function, into arith ops this pass lowers, but `ipowi`, `absi`, `cttz`,
`ctpop` and `sincos` still have no lowering.
[mlir][Presburger] Add IntegerRelation::gist (context-based simplification)
Add IntegerRelation::gist(context), a port of ISL's isl_basic_map_gist
(uset_gist / uset_gist_full). It replaces the relation S by a relation
S' such that S' ∩ context == S ∩ context, with as few constraints as
possible: constraints of S that are implied by the context together with
the remaining constraints of S are removed, and the remaining constraints
may be rewritten using the equalities of the context. Outside of the
context S' may differ from S, so the result is only meaningful together
with the context. The result has at most as many constraints as S
(except that the constraints defining a division that is still used may
be restored, see below), never more local variables, and never involves
variables that S does not involve; in particular, locals of the context
are never introduced.
Trivial cases: an obviously empty context yields the universe; if the
intersection with the context is found to be empty later (inconsistent
combined equalities, a context that turns out to be rationally empty, or
an empty combined Simplex), the result is empty; an obviously empty S
[43 lines not shown]
[mlir][Presburger] Add PresburgerRelation::gist
Add PresburgerRelation::gist (and PresburgerSet forwarding overloads)
for a convex context and for a context that is itself a union of
disjuncts, following ISL's isl_map_gist / isl_map_gist_basic_map.
For a convex context, each disjunct is simplified separately with
IntegerRelation::gist; disjuncts that become empty are dropped and if any
disjunct becomes the universe, the universe is returned.
For a non-convex context, the trivial cases (universe set or context,
empty context, equal set and context, context being a subset of the
set) are handled first. Otherwise, the context is approximated by a
convex set. Instead of ISL's unshifted simple hull of the context and the
set, we use the universe together with all constraints of the disjuncts
of the context and of the set that are valid for every disjunct of the
context (checked with Simplex); including the constraints of the set
allows removing constraints that are implied by every disjunct of the
context even if they are not implied by the simple hull.
[mlir][Presburger] Add IntegerRelation::reduceUsingEqualities helper
Add a protected helper that rewrites all constraints of a relation using
the equalities of another relation in the same space, without changing
the intersection of the two. This is a port of ISL's
isl_basic_set_reduce_using_equalities together with
project_onto_involved: the equalities are first projected onto the
variables that occur in the relation being reduced, so that no new
variables (in particular, no locals of the other relation) are
introduced, and each remaining equality is then used to eliminate its
last variable with a non-zero coefficient from every constraint, so that
later variables (locals) are eliminated in favor of earlier ones.
This is a building block for context-based simplification (gist) and is
exercised by the gist tests added in a follow-up commit, since there is
no existing pattern for unit-testing protected members of
IntegerRelation.
[mlir][Presburger] NFC: factor out removeRedundantConstraintsFromSimplex
Split the compaction loops of IntegerRelation::removeRedundantConstraints
into a new protected helper, removeRedundantConstraintsFromSimplex, which
removes the constraints of the relation that are marked redundant in a
given Simplex, where the relation's constraints start at a given offset
in the Simplex (inequalities first, then each equality as a pair).
This allows reusing the same compaction logic when the relation's
constraints have been added to a Simplex that already contains other
constraints, e.g., for context-based simplification (gist), where the
context's constraints come first and are never marked redundant.
[VPlan] Don't skip adds of wide IVs in makeScalarizationDecisions. (#235589)
makeScalarizationDecisions skipped adds with a wide induction operand,
as narrowing them could leave the wide induction with only scalar users,
which stopped removeRedundantCanonicalIVs from reusing it for the wide
canonical IV.
This is no longer relevant after folding the logic into
replaceWideCanonicalIVWithWideIV, which reuses any remaining canonical
wide induction regardless of its users, so the exclusion is no longer
needed.
[scudo] Avoid reading tls pointer twice. (#235167)
Change the setCurrentTSD()/setDisableMemInit() functions so that they
only do a single load/store of the tls value.
[InstCombine] Only fold gep-of-select-of-constants for const load (#231320)
foldSelectGEP threads a constant-indexed GEP through the constant arms
of
a select. It had no use-count guard, so for a select shared by N
constant-offset GEPs it fired N times, replacing one select plus N GEPs
with N selects.
On a double-buffered (ping-pong) AMDGPU kernel this turned one base
pointer select into ~200 selects off the same condition. Each lowers to
s_cselect_b32, which reads SCC, so all of them had to be materialized
back to back after the compare and kept live, pushing the function from
12 to 105 SGPRs and introducing 99 writelane/readlane spill pairs in a
single block.
Since the primary goal of foldSelectGEP is to enable
ConstantFoldLoadFromConstPtr.
So we have added a pattern in InstCombine visitLoad that starts from the
load, look
[15 lines not shown]
[VPlan]Split the latch-check match out of the branch simps (NFC) (#235592)
Extract the two forms of the vector loop's latch check - BranchOnCount
against the vector trip count, and the active-lane-mask form used when
the tail is folded by masking - into isVectorLatchCheck. The branch
condition is now matched once up front, so the check and the
condition-based proof share it.
[compiler-rt] Add fnan2, fnorm2, funder to macho_embedded arm.txt (#235847)
After #168394, armv6m's mulsf3.S references these helpers, but they were
filtered out of the macho_embedded builtins, leaving undefined symbols
at link time.
Assisted-By: Claude
rdar://191033874