[AArch64] Guard against large types in performOrXorChainCombine (#222146)
Larger type sizes will be legalized to i64, and will hit a crash in
checking constants.
Fixes #222089
Inline cached AST context lookup for declarations
Route declaration context queries through the cached DeclContext path and
define the common path inline. This avoids walking to the translation unit
and removes a hot out-of-line call.
CTMark O0 (3 samples, CPU 6): 29.239400 s -> 28.975433 s (-0.903%).
Impact on significant TUs in MLIR build time:
- `mlir/lib/RegisterAllDialects.cpp`: 2.4845% fewer retired
instructions.
- `mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp`: 1.4241% fewer retired
instructions.
Assisted-by: Codex
Speed up common template argument checks
Avoid setting up pack and constraint machinery for ordinary unconstrained
template argument lists. Reuse canonical type work, keep common converted
argument lists inline, and skip default-substitution comparisons when the
parameter has no default.
CTMark O0 (3 samples, CPU 6): 29.439800 s -> 29.315900 s (-0.421%).
Impact on significant TUs in MLIR build time:
- `mlir/lib/RegisterAllDialects.cpp`: 0.7009% fewer retired
instructions.
- `mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp`: 0.6378% fewer retired
instructions.
Assisted-by: Codex
Cache analysis-warning gates by diagnostic state
Avoid resolving the same disabled warning groups for every function. Reuse one
cached policy for the lifetime, uninitialized-use, fallthrough, recursion,
noexcept, and logical-error analysis gates.
CTMark O0 (3 samples, CPU 6): 29.439800 s -> 29.457833 s (+0.061%).
Impact on significant TUs in MLIR build time:
- `mlir/lib/RegisterAllDialects.cpp`: 1.5439% fewer retired
instructions.
- `mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp`: 0.7746% fewer retired
instructions.
Assisted-by: Codex
Lazily allocate rare expression evaluation state
Keep common expression evaluation records compact by moving diagnostic and
feature-specific collections behind one lazily allocated rare-data object.
Add a no-rare-data pop path to avoid checking empty collections.
CTMark O0 (3 samples, CPU 6): 29.439800 s -> 29.219367 s (-0.749%).
Impact on significant TUs in MLIR build time:
- `mlir/lib/RegisterAllDialects.cpp`: 1.6043% fewer retired
instructions.
- `mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp`: 0.9162% fewer retired
instructions.
Assisted-by: Codex
Cache stable DeclContext relationships
Cache owning AST and stable primary contexts after their first traversal.
Leave incomplete tag and Objective-C contexts uncached until a definition
makes the primary context stable.
CTMark O0 (3 samples, CPU 6): 29.439800 s -> 29.239400 s (-0.681%).
Impact on significant TUs in MLIR build time:
- `mlir/lib/RegisterAllDialects.cpp`: 2.8987% fewer retired
instructions.
- `mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp`: 1.4486% fewer retired
instructions.
Assisted-by: Codex
Bypass setup for complete local DeclContext lookups
Query an existing complete local lookup map directly. Preserve the full
primary-context and external-source path whenever lazy or external storage
can affect the result.
CTMark O0 (3 samples, CPU 6): 29.439800 s -> 29.268133 s (-0.583%).
Impact on significant TUs in MLIR build time:
- `mlir/lib/RegisterAllDialects.cpp`: 1.3266% fewer retired
instructions.
- `mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp`: 0.4887% fewer retired
instructions.
Assisted-by: Codex
Cache DeclContext-to-Decl conversions
Cache the corresponding Decl pointer after the first DeclContext conversion
and route parent traversal and generic casts through the cache. Use relaxed
atomic access so concurrent read-only AST traversal remains race-free.
CTMark O0 (3 samples, CPU 6): 29.439800 s -> 29.303500 s (-0.463%).
Impact on significant TUs in MLIR build time:
- `mlir/lib/RegisterAllDialects.cpp`: 2.5437% fewer retired
instructions.
- `mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp`: 1.3250% fewer retired
instructions.
Assisted-by: Codex
Speed up Sema virtual-method no-work paths
Skip override and hidden-virtual analysis when class structure proves
there is no work to perform. Avoid swapping empty ODR-use maps when
leaving an expression evaluation context.
CTMark O0 (3 samples, CPU 6): 29.439800 s -> 29.619533 s (+0.611%).
Impact on significant TUs in MLIR build time:
- `mlir/lib/RegisterAllDialects.cpp`: 4.9758% fewer retired
instructions.
- `mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp`: 1.8612% fewer retired
instructions.
Assisted-by: Codex
Cache the most recent diagnostic source file
Avoid repeated ordered-map lookups while diagnostics remain in the same
source file. Clear the cached map node whenever the map is reset.
CTMark O0 (3 samples, CPU 6): 29.439800 s -> 29.312967 s (-0.431%).
Impact on significant TUs in MLIR build time:
- `mlir/lib/RegisterAllDialects.cpp`: 1.0930% fewer retired
instructions.
- `mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp`: 0.5034% fewer retired
instructions.
Assisted-by: Codex
[ORC] Move ExecutorSharedMemoryMapperService names to sps_ci (#222835)
Relocate the service's interface names and SPS signatures from rt:: in
OrcRTBridge into a new Shared/SPSCI/SharedMemoryMapperSPSCI.h, matching
the existing SPSCI descriptor convention. Name-neutral: the symbol
strings are unchanged.
[MLIR] Fix infinite loop in tryFold in Graph Regions (#189232)
In a graph region (e.g. the module body), an op may use its own result
as an operand, creating a circular SSA dependency. When such an op was
passed to OpBuilder::tryFold, the do-while loop could spin forever:
1. foldCommutative moved the constant operand to the RHS (in-place fold,
foldResults still empty).
2. The next fold call returned the op's own result, signalling an
in-place fold, but foldSingleResultHook re-ran trait folds, found
nothing to swap, and returned success with empty foldResults.
3. Step 2 repeated without end.
Fix: cap the number of in-place fold iterations at 64. Legitimate chains
are very short in practice (foldCommutative swaps once, then the op folds to
a value or constant), so the cap is never reached for correct IR. For the
circular-SSA case the loop now terminates and tryFold returns failure,
letting dialect conversion fall through to a conversion pattern instead of
looping.
[10 lines not shown]
[KnownFPClass] Add sNaN deductions for log/log2/log10 (#219703)
`log(x)` can only produce `sNaN` if `x` is `sNaN`.
This also affects tests for `llvm.amdgcn.log.f16` and
`llvm.amdgcn.log.f32`.
RISCV: Maintain VL/VTYPE liveness when clearing dead flags in InsertVSETVLI (#222862)
Drop the stale VL/VTYPE ranges when a dead flag is cleared.
RISCVInsertVSETVLI marks the VL and VTYPE defs of an explicit VSETVLI as
live by clearing their dead flags, but did not update LiveIntervals. When a def
was previously a dead def, its live range is a zero-length dead-def segment
ending at the def slot; clearing the flag extends the def past that slot
without extending the range leaving a segment that references no instruction.
Co-authored-by: Claude claude-opus-4.8 <noreply at anthropic.com>
[GVN] Skip instructions without value numbers in `processNonLocalLoad` (#219851)
GVN may insert coercion instructions (MaterializeAdjustedValue) without
assigning them value numbers. If one becomes a GEP index of a PRE'd load
in the same processBlock sweep, the GEP-index scalar PRE in
processNonLocalLoad reaches it before the next re-numbering iteration
and the verifying VN.lookup() may assert. Avoid performing PRE on such
instructions.
Fixes: #216265.
[AArch64] Parameterize repeated FP divisor combine threshold by subtarget (#216930)
Changes:
This patch makes the threshold for combining repeated FP divisors
configurable per AArch64 subtarget, instead of using a single fixed
value 3 for all CPUs. Additionaly, set this value 2 for A64FX based on
observed profitability for this transform on A64FX.
Motivation:
Today, AArch64 uses a fixed threshold of 3 for reciprocal transform.
This means the transform runs when there are 3 FDIVs with the same
divisor (not 2). That is conservative for some subtargets, and it can
miss profitable opportunities on CPUs such as A64FX, where a lower
threshold appears to produce better code generation.
```
a / D; b / D; ...
=>
recip = 1.0 / D; a * recip; b * recip; ...
```
[2 lines not shown]
[AMDGPU] Update buildbot cmake cache files (#222807)
This fixes one issue where the compiler-rt entry was not propagated to
the build.
We also want to select libgcc as the default unwindlib explicitly (as
this is what we do downstream).
[lldb] Fix handling of lldb managed software breakpoints (#222009)
Fixes #217910.
When the debug server can manage its own breakpoints this is called an
"external" breakpoint. When it cannot, lldb must manage the breakpoint
itself from the client side.
Part of doing that is FindInRange which is used to patch reads and
writes over software breakpoint sites. It had an issue where it would
not account for a breakpoint that started before the range, but extended
into the range. For example:
```
Memory content: ABCDEFGHIJKL
Read range: ----[--]----
Breakpoint location: -BKPT-------
Overlap with read: ----@-------
Expected read result: ----EFGH----
Would actually get: ----TFGH----
[17 lines not shown]
ARM: Avoid relying on kill flags for determining CPSR liveness
When forming CBZ/CBNZ in ARMConstantIslands, check if CPSR is live-out
of the block instead of relying on the kill flag. Kill flags have been
soft deprecated for over a decade.
Co-authored-by: Claude claude-opus-4.8 <noreply at anthropic.com>
[Clang] Improve error recovery for indexed template names (#222328)
There were a few issues here:
- Names that are not templates were not diagnosed and led to a crash (in
part because clang think they can be template names that will be later
resolved by ADL)
- Names that refer to a variable template decl, etc also led to a crash.
Fixes #220502
Co-authored-by: Cursor <cursoragent at cursor.com>
[RISCV] Ignore debug instructions in epilogue block checks (#219401)
A debug instruction in a return-only block can make
`RISCVFrameLowering::canUseAsEpilogue` reject an otherwise valid
shrink-wrap
point. This moves the save and restore libcalls onto the fast path.
Ignore debug instructions in the successor cardinality check while
continuing
to count bundle interiors, pseudo probes, and other non-debug
instructions.
The first commit records the existing behavior. The second applies the
fix and
updates the test expectations to require localized save and restore
calls.
Fixes #219378
[6 lines not shown]