LLVM/project 58c46ballvm/lib/Target/AArch64 AArch64ISelLowering.cpp, llvm/test/CodeGen/AArch64 bcmp.ll i128-imm-compare-ccmp.ll

[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
DeltaFile
+17-0llvm/test/CodeGen/AArch64/i128-imm-compare-ccmp.ll
+6-8llvm/test/CodeGen/AArch64/bcmp.ll
+2-1llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+25-93 files

LLVM/project b32f85allvm/include/llvm InitializePasses.h, llvm/include/llvm/CodeGen Passes.h ResetMachineFunctionPass.h

[CodeGen][NPM] Port ResetMachineFunction to NPM
DeltaFile
+77-63llvm/lib/CodeGen/ResetMachineFunctionPass.cpp
+36-0llvm/include/llvm/CodeGen/ResetMachineFunctionPass.h
+2-1llvm/include/llvm/CodeGen/Passes.h
+1-1llvm/lib/CodeGen/TargetPassConfig.cpp
+1-1llvm/include/llvm/Passes/MachinePassRegistry.def
+1-1llvm/include/llvm/InitializePasses.h
+118-672 files not shown
+120-678 files

LLVM/project 57c3115clang/include/clang/AST DeclBase.h, clang/lib/AST DeclBase.cpp

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
DeltaFile
+7-0clang/include/clang/AST/DeclBase.h
+0-4clang/lib/AST/DeclBase.cpp
+7-42 files

LLVM/project 6fe5833clang/include/clang/Sema Sema.h, clang/lib/Sema SemaTemplate.cpp

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
DeltaFile
+59-23clang/lib/Sema/SemaTemplate.cpp
+3-2clang/include/clang/Sema/Sema.h
+62-252 files

LLVM/project f05ee3cclang/include/clang/Sema AnalysisBasedWarnings.h, clang/lib/Sema AnalysisBasedWarnings.cpp

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
DeltaFile
+48-16clang/lib/Sema/AnalysisBasedWarnings.cpp
+16-0clang/include/clang/Sema/AnalysisBasedWarnings.h
+64-162 files

LLVM/project d0397a0clang/include/clang/Sema Sema.h, clang/lib/Parse ParseStmt.cpp

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
DeltaFile
+90-47clang/lib/Sema/SemaExpr.cpp
+23-32clang/include/clang/Sema/Sema.h
+10-8clang/lib/Sema/SemaExprCXX.cpp
+12-6clang/lib/Sema/SemaChecking.cpp
+10-6clang/lib/Sema/TreeTransform.h
+5-4clang/lib/Parse/ParseStmt.cpp
+150-1033 files not shown
+155-1069 files

LLVM/project d218f7fclang/include/clang/AST DeclBase.h, clang/lib/AST DeclBase.cpp

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
DeltaFile
+55-17clang/lib/AST/DeclBase.cpp
+17-2clang/include/clang/AST/DeclBase.h
+72-192 files

LLVM/project b79bb2aclang/lib/AST DeclBase.cpp

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
DeltaFile
+11-0clang/lib/AST/DeclBase.cpp
+11-01 files

LLVM/project 844da7cclang/include/clang/AST DeclBase.h, clang/lib/AST DeclBase.cpp

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
DeltaFile
+20-6clang/include/clang/AST/DeclBase.h
+8-1clang/lib/AST/DeclBase.cpp
+28-72 files

LLVM/project cac8d7fclang/lib/Sema SemaExpr.cpp SemaDeclCXX.cpp

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
DeltaFile
+5-2clang/lib/Sema/SemaDecl.cpp
+3-2clang/lib/Sema/SemaExpr.cpp
+3-2clang/lib/Sema/SemaDeclCXX.cpp
+11-63 files

LLVM/project cc860d8clang/include/clang/Basic Diagnostic.h, clang/lib/Basic Diagnostic.cpp

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
DeltaFile
+9-3clang/lib/Basic/Diagnostic.cpp
+6-0clang/include/clang/Basic/Diagnostic.h
+15-32 files

LLVM/project 63cc989clang/lib/Interpreter IncrementalExecutor.cpp, llvm/include/llvm/ExecutionEngine/Orc/Shared OrcRTBridge.h

[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.
DeltaFile
+60-0llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/SharedMemoryMapperSPSCI.h
+16-16llvm/lib/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.cpp
+0-23llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h
+6-9llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+6-9clang/lib/Interpreter/IncrementalExecutor.cpp
+6-7llvm/unittests/ExecutionEngine/Orc/SharedMemoryMapperTest.cpp
+94-642 files not shown
+99-838 files

LLVM/project 3d6ae4bmlir/lib/IR Builders.cpp, mlir/test/Transforms test-legalizer.mlir

[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]
DeltaFile
+11-1mlir/lib/IR/Builders.cpp
+11-0mlir/test/Transforms/test-legalizer.mlir
+22-12 files

LLVM/project 5f604ffutils/bazel/llvm-project-overlay/mlir BUILD.bazel

[BUILD] Fix for 02dc8a35 (#222876)

[BUILD] Fix for 02dc8a35
DeltaFile
+1-0utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
+1-01 files

LLVM/project 18b9d72llvm/lib/Support KnownFPClass.cpp, llvm/test/Transforms/Attributor nofpclass-log.ll

[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`.
DeltaFile
+58-8llvm/test/Transforms/Attributor/AMDGPU/nofpclass-amdgcn-log.ll
+12-12llvm/test/Transforms/Attributor/nofpclass-log.ll
+2-1llvm/unittests/CodeGen/GlobalISel/KnownFPClassTest.cpp
+2-0llvm/lib/Support/KnownFPClass.cpp
+74-214 files

LLVM/project 6700445llvm/lib/Target/RISCV RISCVInsertVSETVLI.cpp, llvm/test/CodeGen/RISCV/rvv vsetvli-dead-vl-vtype-liveness.mir

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>
DeltaFile
+33-0llvm/test/CodeGen/RISCV/rvv/vsetvli-dead-vl-vtype-liveness.mir
+10-0llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
+43-02 files

LLVM/project 12f00f9llvm/lib/Transforms/Scalar GVN.cpp, llvm/test/Transforms/GVN pre-coerced-value-not-numbered.ll

[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.
DeltaFile
+43-0llvm/test/Transforms/GVN/pre-coerced-value-not-numbered.ll
+4-1llvm/lib/Transforms/Scalar/GVN.cpp
+47-12 files

LLVM/project 7bb74b1mlir/lib/Conversion/ComplexToLLVM ComplexToLLVM.cpp, mlir/test/Conversion/ComplexToLLVM convert-to-llvm.mlir

[mlir][ComplexToLLVM] Fix abs op fmf propagation (#222621)
DeltaFile
+1-1mlir/test/Conversion/ComplexToLLVM/convert-to-llvm.mlir
+1-1mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp
+2-22 files

LLVM/project 478b91bmlir/lib/Conversion/ComplexToStandard ComplexToStandard.cpp, mlir/test/Conversion/ComplexToStandard convert-to-standard.mlir

[mlir][ComplexToStandard] Fix Conj and Neg ops fmf propagation (#222622)
DeltaFile
+29-0mlir/test/Conversion/ComplexToStandard/convert-to-standard.mlir
+6-3mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp
+35-32 files

LLVM/project 4f32e47llvm/lib/Target/AArch64 AArch64Processors.td AArch64ISelLowering.cpp, llvm/test/CodeGen/AArch64 fdiv-combine.ll

[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]
DeltaFile
+31-0llvm/test/CodeGen/AArch64/fdiv-combine.ll
+3-2llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+5-0llvm/lib/Target/AArch64/AArch64Features.td
+2-1llvm/lib/Target/AArch64/AArch64Processors.td
+41-34 files

LLVM/project 9f634aautils/bazel/llvm-project-overlay/mlir BUILD.bazel

[Bazel] Fixes 7ba3ce4 (#222865)

This fixes 7ba3ce428af7f6e7f1e642dba128c2afc13dba90 (#222859).

Buildkite error link:
https://buildkite.com/llvm-project/upstream-bazel/builds?commit=7ba3ce428af7f6e7f1e642dba128c2afc13dba90

Co-authored-by: Google Bazel Bot <google-bazel-bot at google.com>
DeltaFile
+1-0utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
+1-01 files

LLVM/project 2684037offload/cmake/caches AMDGPULibcBot.cmake AMDGPUBot.cmake

[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).
DeltaFile
+2-1offload/cmake/caches/AMDGPULibcBot.cmake
+2-1offload/cmake/caches/AMDGPUBot.cmake
+4-22 files

LLVM/project 19dad06lldb/include/lldb/Breakpoint StopPointSiteList.h, lldb/test/API/functionalities/breakpoint/write_over_software_breakpoint TestWriteOverSoftwareBreakpoint.py

[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]
DeltaFile
+41-36lldb/test/API/functionalities/breakpoint/write_over_software_breakpoint/TestWriteOverSoftwareBreakpoint.py
+6-2lldb/include/lldb/Breakpoint/StopPointSiteList.h
+47-382 files

LLVM/project e4b9c07llvm/include/llvm/CodeGenTypes LowLevelType.h

[GlobalISel] Fast path exact LLT equality (NFC) (#222550)

Improves CTMark geomean -0.05% on aarch64-O0-g.

https://llvm-compile-time-tracker.com/compare.php?from=87d9c3c24ff5941ac08799850a6549b561c98a81&to=a5391cd5be815299b2cddcabf62a86369b247f72&stat=instructions:u

Assisted-by: codex
DeltaFile
+4-1llvm/include/llvm/CodeGenTypes/LowLevelType.h
+4-11 files

LLVM/project b6865cdllvm/lib/Target/ARM ARMConstantIslandPass.cpp, llvm/test/CodeGen/ARM cbz-no-kill-flag.mir

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>
DeltaFile
+132-0llvm/test/CodeGen/ARM/cbz-no-kill-flag.mir
+8-4llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
+140-42 files

LLVM/project 5e64eb8clang/lib/Parse ParseDeclCXX.cpp, clang/lib/Sema SemaTemplateVariadic.cpp

[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>
DeltaFile
+14-6clang/lib/Parse/ParseDeclCXX.cpp
+18-2clang/test/SemaCXX/cxx2d-pack-indexing-template.cpp
+5-0clang/lib/Sema/SemaTemplateVariadic.cpp
+37-83 files

LLVM/project c382571llvm/cmake/modules CrossCompile.cmake

[CMake] Forward CLANG_ENABLE_CIR to native tool builds (#222771)
DeltaFile
+2-0llvm/cmake/modules/CrossCompile.cmake
+2-01 files

LLVM/project e8a0d25llvm/test/Analysis/CostModel/X86 shuffle-reverse.ll shuffle-single-src.ll

[CostModel][X86] Cleanup unary shuffle cost tests to use poison instead of undef in second operand (#222718)
DeltaFile
+2,066-2,066llvm/test/Analysis/CostModel/X86/shuffle-extract_subvector.ll
+294-294llvm/test/Analysis/CostModel/X86/shuffle-insert_subvector.ll
+244-244llvm/test/Analysis/CostModel/X86/shuffle-splat.ll
+244-244llvm/test/Analysis/CostModel/X86/shuffle-broadcast.ll
+227-227llvm/test/Analysis/CostModel/X86/shuffle-single-src.ll
+169-169llvm/test/Analysis/CostModel/X86/shuffle-reverse.ll
+3,244-3,2444 files not shown
+3,275-3,27510 files

LLVM/project f284ae2llvm/lib/Target/RISCV RISCVFrameLowering.cpp, llvm/test/CodeGen/RISCV shrinkwrap-save-restore-debug.ll

[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]
DeltaFile
+93-0llvm/test/CodeGen/RISCV/shrinkwrap-save-restore-debug.ll
+7-3llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
+100-32 files

LLVM/project 3ec1c43llvm/lib/Transforms/Scalar ConstraintElimination.cpp, llvm/test/Transforms/ConstraintElimination monotonic-int-phis-signed.ll strengthen-flags-at-uses.ll

[ConstraintElim] Strengthen flags at the closest dominator of all uses. (#220918)

Flags are currently only strengthened using the facts that hold on entry
to the block defining the instruction. This overly pessimistic. It is
sufficient to check at the closest instruction dominating all uses.

Extend FactOrCheck to carry this point as context instruction (in union
with the mutually exclusive DoesHold to avoid size growth) and retrieve
the common dominating instruction when queuing instructions for flag
strengthening.

This strengthens flag inference in a number of real-world cases, as well
as enables additional folds due stronger flags:
https://github.com/dtcxzyw/llvm-opt-benchmark-nightly/pull/1171

Compile-time impact is in the noise

https://llvm-compile-time-tracker.com/compare.php?from=11bc6ce46e227718c3b54aa6889d7458656e8ab4&to=6f67fdcdb62a5fe56060cb266448db8b763e13d7&stat=instructions:u

PR: https://github.com/llvm/llvm-project/pull/220918
DeltaFile
+393-0llvm/test/Transforms/ConstraintElimination/strengthen-flags-at-uses.ll
+47-15llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
+3-3llvm/test/Transforms/ConstraintElimination/monotonic-int-phis-signed.ll
+443-183 files