RuntimeLibcalls: Handle int and long size more similarly
Previously we eagerly computed the int size and passed it through all
the various functions to get the type signature. The long cases were
evaluated in the context that need a long. Treat these the same way
which reduces the number of arguments passed around.
[flang][OpenMP] Support for nocontext and novariants clauses for dispatch construct (#227954)
Support for nocontext and novariants clauses for dispatch construct in
flang.
[libc] Use a syscall wrapper for sendfile (#237955)
This PR move sendfile behind the centralized syscall wrappers, following
libc/docs/dev/syscall_wrapper_refactor.md.
---
<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
[libc] Use a syscall wrapper for uname (#237954)
This PR move uname behind the centralized syscall wrappers, following
libc/docs/dev/syscall_wrapper_refactor.md.
---
<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
RuntimeLibcalls: Stop returning an attribute when getting libcall types (#238209)
The attribute half of the pair has been empty since the extension
attributes moved to getIntExtAttr, so return just the type.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
CodeGen: Replace TargetOptions::DebuggerTuning with module flag
Read the debugger tuning from the module's "debugger-tuning" flag instead of
TargetOptions. Delete the now-dead -debugger-tune= cl::opt and the
TargetOptions::DebuggerTuning field.
Update the tests relying on it to directly use the module flag. The cases
that exercise multiple values do a text substitution to swap the value.
Alternatively this could be changed to synthesize the module flag in the
llc flag like some of the other widely used module flags do.
Co-authored-by: Claude Sonnet 5 <noreply at anthropic.com>
Attributor: Only use anchor instruction effects for call site positions (#231635)
AAMemoryBehavior initialized the known state of a position from the
mayReadFromMemory/mayWriteToMemory of its anchor instruction. This is
only correct when the anchor is the call. For a floating pointer value
defined by a load, the load does not write, but the pointer may still be
written through. AAInvariantLoadPointer then marked loads as invariant
that were clobbered in the same function, which miscompiled sqlite3 with
-attributor-enable=full.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[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::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 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.
RuntimeLibcalls: Stop returning an attribute when getting libcall types
The attribute half of the pair has been empty since the extension
attributes moved to getIntExtAttr, so return just the type.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[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.
Drop a redundant mask and reword the inline-addend comment
Assigning to the 19-bit bitfield already truncates, and the comment had
lost a verb. Say which linker we match and that the field is two's
complement.
Assisted-by: Claude Code
[mlir][Presburger] NFC: factor out removeRedundantConstraintsFromSimplex (#235955)
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.
---
<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
[4 lines not shown]
CodeGen: Remove -verify-machineinstrs from llc -passes MIR tests (#238157)
With the new pass manager, -verify-machineinstrs does not add a
verifier after each pass; only -verify-each does. Bizarrely, instead
it suppresses the verifier llc runs at the end of the pipeline, so
removing it enables verification of the output. This is probably a
bug, but I think the plan is to replace this flag in the new PM
anyway.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[ORC] Ignore non-prefixed strings in InProcessDylibManager. (#238143)
InProcessDylibManager::lookupSymbolsAsync was unconditionally dropping
the first character from symbol names whenever a global prefix was set,
without checking that the first character matched the prefix. E.g. on
Darwin, where the global prefix is '_', a lookup of `printf` should
generate a SymbolsNotFound error (the C function is `_printf`), but
instead it generated a lookup of `rintf`, which binds against a rounding
function from math.h.
This patch fixes the issue by checking that the first character in the
symbol name matches the prefix, returning std::nullopt if it does not.
See discussion at:
https://github.com/llvm/llvm-project/issues/5852#issuecomment-6362518329
[libc] Add POSIX-mandated transitive header inclusion to three headers. (#237436)
Per POSIX standard:
* `<sys/sem.h>` shall include the `<sys/ipc.h>` header
* Inclusion of the `<threads.h>` header shall make
symbols defined in the header `<time.h>` visible.
* Inclusion of the `<pthread.h>` header shall make symbols
defined in the headers `<sched.h>` and `<time.h>` visible.
There are real-world programs which correctly rely on this
behavior.
Implement all of the above using `public_includes` feature in YAML
config
to add transitive inclusions to generated headers. Technically speaking,
we can "make symbols visible" using other mechanisms, but simple
transitive inclusion is by far the easiest one.
[MachineOutliner] Skip returns_twice functions (#237875)
fixes: #237874
If a function returns twice, or calls a function that can return twice,
skip it. The context saved by functions such as `setjmp` will be
different if they take place within an outlined function. Ex: Saved
stack pointer will be different.
Was able to trigger a crash by outlining a call to a returns_twice
function.
[clang][NFC] Test Linux/Windows Multilib Resource Dirs (#238147)
This is another follow-up to 78820cb91605693b7d768be4ebc8b66181d3e9c3 to
show the behaviour of resource dir resolution after that change.
Assisted-by: AI