[AArch64] Make compiling arm_neon.h faster (#226378)
Replace two linear scans with map lookups.
On my system, reduces time to compile a TU that does nothing but
`#include <arm_neon.h>` from 92.0 ms ± 1.4 ms to 70.9 ms ± 1.3 ms.
No behavior change.
LoongArch: Respect the target-abi module flag in the ELF header
The target streamer read the ABI from MCTargetOptions when constructed,
so the e_flags recorded the command line -target-abi and ignored the
module flag.
Co-Authored-By: Claude Opus 5 <noreply at anthropic.com>
LoongArch: Register a null target streamer
Emitting a TLS variable's debug location calls into the target streamer,
which was only registered for asm and object output. -filetype=null
therefore null dereferenced.
Co-Authored-By: Claude Opus 5 <noreply at anthropic.com>
[SystemZ][z/OS] Use section ordinal for temporary symbols
A relocation involving a temporary symbol is interpreted as offset
of the symbol to the section begin. Currently, this is resolved via
the begin symbol of the section. However, that symbol may also have
the temporary flag set, and therefore has an index of 0. Since a
symbol is emitted of reach section, it is safe to use the ordinal
of the section instead, avoiding all issues with temporary symbols.
[CIR] Match OGCG noalias and memory effects on operator new
Sane replaceable operator new calls get return noalias, and new-expressions
also get memory(inaccessiblemem: readwrite, errnomem: write), matching classic
codegen. -fno-assume-sane-operator-new drops both.
Co-authored-by: Cursor <cursoragent at cursor.com>
[orc-rt] Tighten move_only_function ShouldCopyInitialize test. (#226483)
ShouldCopyInitialize only checked that constructing a move_only_function
from an lvalue didn't move the callable, so it passed when the callable
was held by reference and never copied at all.
This commit replaces the moved flag with copy and move counters, and
checks that construction performs exactly one copy and no moves.
[docs][clang] Document additional public profile runtime APIs (#224424)
Android's code coverage runtime started using these functions recently,
and I noticed they were undocumented (and the reviewer highlighted
that `instr_prof_interface.h` exists).
So this commit:
- Moves their declarations to that header
- Updates `SourceBasedCodeCoverage.md` to highlight that header
- Adds quips to said `.md` file for these functions
An LLM was used to take a first pass at this; I reviewed and refined.
ARM: Remove cached TargetABI from ARMBaseTargetMachine
This cannot account for the "target-abi" module flag, so
let the uses query that. ARMElfTargetObjectFile was the one user of
this value, so this failed to respect the module flag.
Co-Authored-By: Claude Opus 5 <noreply at anthropic.com>
[flang][OpenMP] Rename some symbols in check-omp-syntax.cpp
Some function names did not conform to the naming convention.
Include a couple of other non-significant changes.
[orc-rt] Fix move_only_function storing references to lvalue callables. (#226474)
move_only_function's converting constructor instantiated CallableImpl
with the deduced forwarding-reference type, so constructing from an
lvalue callable stored a reference to it rather than a copy, leaving the
move_only_function dangling once the original went out of scope.
This commit decays the callable type before instantiating CallableImpl,
and adds a static_assert to CallableImpl to enforce that it's only
instantiated with decayed types.
[SimplifyCFG] Keep a debug location on calls cloned by `FoldBranchToCommonDest` (#224247)
Fixes #220848
When folding a branch to a common destination, SimplifyCFG clones the
bonus instructions into the predecessor and resets their debug
locations, so the debugger doesn't step onto code from a branch that
wasn't taken. It did that with `setDebugLoc(DebugLoc::getDropped())` for
every instruction. That's fine for an `icmp`, but with
`-bonus-inst-threshold=2` a `speculatable` call can be a bonus
instruction too, and an inlinable call in a function with debug info
must have a `!dbg` location, otherwise the inliner can't set up the
inlined-at scope. The verifier rejects the module with "inlinable
function call in a function with debug info must have a !dbg location".
The clone now uses `Instruction::dropLocation()`, which is what
`speculativelyExecuteBB` in the same file already does. Non-call
instructions still lose their location as before, while calls get a line
0 location in the function's scope, so nothing misleading shows up when
[4 lines not shown]
[LifetimeSafety] Enable C support by default under -Wlifetime-safety (#224028)
This PR extends the lifetime safety analysis to C. When the analysis is
enabled with `-Wlifetime-safety`, it now also runs on C code without the
extra `-fexperimental-lifetime-safety-c` flag.
I have renamed `-fexperimental-lifetime-safety-c` to
`-flifetime-safety-c` since it is on by default from now on. The
`-fno-lifetime-safety-c` flag disables the analysis for C. I have
updated the documentation and the release notes and rewrote the RUN
lines of the test cases that used the old flag.
[AMDGPU] Fold sudot intrinsics with a zero multiplicand
Replace sudot4 and sudot8 with their accumulator when either
multiplicand is zero.
For example:
```
sudot4(sign0, x, sign1, 0, acc, clamp)
->
acc
```
[AMDGPU] Canonicalize constant operands of sudot intrinsics
Move a constant multiplicand and its sign flag to the second operand.
For example:
```
sudot4(true, 1, false, x, acc, clamp)
->
sudot4(false, x, true, 1, acc, clamp)
```
[DAG] SimplifySetCC - adjust setcc result type when peeking through truncates (#226422)
For the "(setcc (trunc x) (trunc y)) -> (setcc x y)" fold with non vXi1
cmp result type, make sure we adjust the type and then trunc/extend it
correctly using BooleanContent.
Fixes #226365
[mlir] Avoid rewriting unreachable blocks in the greedy driver
A rewrite can disconnect a block after the iteration's initial CFG sweep.
Track reachability through rewriter notifications and skip worklist
operations in unreachable blocks until the next iteration removes them.
Cache reachability per region and compare final successors after each
rewrite. Preserve the cache for successor-equivalent changes, added edges,
and block merges that keep surviving blocks reachable. Recompute for other
CFG changes, including entry changes and cross-region block moves.
Keep cache updates separate from reachability queries, returning failure
when a full traversal is required. Collect each successor set once for
validation and retain compact vector snapshots in the cache. Entry-block
queries return before cache lookup or CFG traversal.
Cover inserted and redirected blocks, blocks connected before rewrite
completion, nested regions, block moves and merges, and explicit op lists.
Use observer diagnostics to check whether affected operations are processed
[17 lines not shown]
[flang][OpenMP] Improve checks of ORDERED clause
Make the checks version-sensitive.
This adds some diagnostics that effectively replace existing ones.
The old ones will be removed in a later PR, for the time being both
will be shown.
[mlir] Avoid rewriting unreachable blocks in the greedy driver
A rewrite can disconnect a block after the iteration's initial CFG sweep.
Track reachability through rewriter notifications and skip worklist
operations in unreachable blocks until the next iteration removes them.
Cache reachability per region and compare final successors after each
rewrite. Preserve the cache for successor-equivalent changes, added edges,
and block merges that keep surviving blocks reachable. Recompute for other
CFG changes, including entry changes and cross-region block moves.
Keep cache updates separate from reachability queries, returning failure
when a full traversal is required. Collect each successor set once for
validation and retain compact vector snapshots in the cache. Single-block
regions return before cache lookup or CFG traversal.
Cover inserted and redirected blocks, blocks connected before rewrite
completion, nested regions, block moves and merges, and explicit op lists.
Use observer diagnostics to check whether affected operations are processed
[16 lines not shown]
ARM: Use divmod type signatures from RuntimeLibcallsInfo (#217869)
Start moving towards an API to emit calls from RuntimeLibcallsInfo's
knowledge about the type signature of a function instead of manually
computing an IR type from the EVT of the operation.
Also change the swap of arguments to be based on the libcall impl,
rather than the ABI since it's logically a property of the function
itself.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[mlir] Avoid rewriting unreachable blocks in the greedy driver
A rewrite can disconnect a block after the iteration's initial CFG sweep.
Track reachability through rewriter notifications and skip worklist
operations in unreachable blocks until the next iteration removes them.
Cache reachability per region. Compare the final successors of changed
blocks after each rewrite, preserving the cache for successor-equivalent
changes and block merges that keep surviving blocks reachable. Recompute for
other CFG changes. This avoids repeated full CFG scans during branch
canonicalization.
Single-block regions return before cache lookup or CFG traversal. Before the
cache bookkeeping simplification, in the same Release build, canonicalizing
32,000 sibling single-block regions took 22.8 ms versus 21.9 ms with the
parent driver. With 16,000 regions containing folds, the times were 35.7 ms
and 34.3 ms, respectively. Nesting to 256 levels showed no measurable
difference.
[23 lines not shown]