[mlir][ABI] Add the nofreeobj param attr to the LLVM dialect (#222137)
Since #218404 clang marks every indirect argument nofreeobj rather than
nofree. LLVM allows it on returns too.
Assisted-by: Cursor / claude-opus-5
[libc++] Opt `std::*set` out of map key extraction optimization (#220452)
PR #154512 (relanded by #155565) removed `__can_extract_map_key`, which
had a blanket opt-out for `std::*set`s. The new logic does not have that
opt-out, leading to `std::set`s being incorrectly constructed.
The new regression tests demonstrate this, but essentially the idea is:
1. Have `std::set<T> foo;`
2. Call `foo.emplace(some_t,
arg_that_influences_comparisons_or_hashes);`
3. The emplace will internally search using `some_t` as the key, *not*
`T(some_t, arg_that_influences_comparisons_or_hashes);`
This opts out `std::*set` from this optimization to match previous
behavior.
Tests and fix were produced by an LLM. I reviewed them and they seem
reasonable to me, though I don't have a strong background in libc++
testing conventions.
[4 lines not shown]
[MLIR][CMake] Remove aggregate generated-header ordering
Remove the broad mlir-headers prerequisites now that direct links and
HEADER_LIBS relationships provide generated-header ordering.
Keep own generators and intentional source-generation dependencies explicit.
Document migration options for downstream projects that relied on aggregate
ordering.
Assisted-by: Codex
Assisted-by: Claude Code
Co-Authored-By: Claude Fable 5.1 <noreply at anthropic.com>
[MLIR][CMake] Add HEADER_LIBS and document CMake infrastructure
Add HEADER_LIBS as a flat list of literal library targets for generated headers
included without a link relationship. Resolve aliases and forward references,
accept imported libraries as already generated, follow nested HEADER_LIBS and
link interfaces, and reject missing, executable, utility, or generator-
expression entries with configure-time diagnostics. Represent header-only
edges in the common internal INTERFACE graph, including cyclic relationships.
Record links added by mlir_target_link_libraries for the same deferred ordering.
Add explicit, commented HEADER_LIBS edges for every audited header-only include
that is not covered by mlir-generic-headers, and keep this facility a rare
layering escape hatch.
Document dialects, interfaces, passes, PDLL, generated documentation, library
visibility, C API aggregation, tools, exports, standalone consumers, and the
generated-file model. Add a CMake fixture covering cycles, aliases, conditions,
LINK_ONLY, imported and ignored items, post-hoc links, and invalid providers.
Build each consumer independently from a clean state to verify transitive
[5 lines not shown]
[CMake] Propagate generated-header prerequisites through link dependencies
The goal is to simplify and make more robust the handling of generated-header
(TableGen) dependencies. Today these dependencies are managed manually, which
is fragile: missing edges often surface only in parallel builds, and sometimes
in incremental builds.
Record each llvm_add_library DEPENDS list independently from the cumulative
LLVM_COMMON_DEPENDS value, and mark public TableGen targets as generated-header
prerequisites. A deferred traversal follows every direct non-INTERFACE link and
transitive link interface, resolves aliases, and conservatively extracts target
candidates from generator expressions.
Represent generated-header prerequisites with internal INTERFACE libraries.
Let CMake propagate their utility dependencies through the header graph, and
reuse each provider's interface to handle cycles without computing closures.
Disabled generator-expression arms may generate extra headers, but cannot
introduce a provider library or object cycle.
[10 lines not shown]
[AMDGPU] Drop the redundant operand register-class verifier check
The generic MachineVerifier already rejects a register operand whose
class does not fit the instruction's operand class, for both virtual
(hasSuperClassEq / getMatchingSuperRegClass) and physical (contains)
registers, using the HwMode-resolved operand class. On subtargets that
require aligned VGPRs that class is the even-aligned one, so the generic
check catches a misaligned tuple on its own.
Remove SIInstrInfo::verifyInstruction's own alignment and physical
register-class checks and the now-unused getUnalignedEquivalentRC helper.
Misaligned tuples now report the generic "Illegal virtual/physical
register for instruction" instead of "Subtarget requires even aligned
vector registers"; a bad physical class reports the same instead of
"Operand has incorrect register class".
[MLIR] Fix and classify generated-header dependencies
List the TableGen targets owned by each affected library, and add the missing
LLVM generated-header, SPIR-V source-generation, OpenACC/OpenMP generated-input,
and CIR operation/type prerequisites found by clean dependency audits. Correct
two stale copy-paste dependencies and the duplicate CIR link entry.
The Transforms pass declarations and dialect inliner interface are independent
of any dialect. Classify both under mlir-generic-headers, and associate the
inliner interface with MLIRTransformUtils, which publishes InliningUtils.h.
This gives every MLIR library the required ordering without repeated
header-only edges.
Assisted-by: Codex
Assisted-by: Claude Code
Co-Authored-By: Claude Fable 5.1 <noreply at anthropic.com>
[libc++] Backport resolution of LWG2187 to C++11 (#222006)
libc++ has LWG2187 implemented in
2d6e2834a8abcce862ef17c44f62e4de41662748 but only since C++14 mode.
Usually, resolution of an LWG issue should be treated as a Defect Report
and applied to old modes. In the case of LWG2187, the resolution should
be applied to C++11.
[orc-rt] Add Mangling.h with platform symbol name mangling (#222315)
This implements a cut-down version of the LLVM equivalent (in
llvm/include/llvm/ExecutionEngine/Orc/Shared/Mangler.h): SymbolNameSpec
pairs a name with a kind (assembly, C). Mangling functions
(withMangledNameDo, mangledCopy) apply mangling to SymbolNameSpecs based
on the symbol name kind.
These utilities will be used to report symbols (e.g. controller
interface symbols) in the platform's native mangling, so that linking
against them requires no special handling.
[AArch64] Improve scheduling info for WHILE instruction (#221930)
They should have a throughput of 2, only using a single M microop.
This is the V3 equivalent of #219122.
[MLIR][CMake] Remove aggregate generated-header ordering
Remove the broad mlir-headers prerequisites now that direct links and
HEADER_LIBS relationships provide generated-header ordering.
Keep own generators and intentional source-generation dependencies explicit.
Document migration options for downstream projects that relied on aggregate
ordering.
Assisted-by: Codex
Assisted-by: Claude Code
Co-Authored-By: Claude Fable 5.1 <noreply at anthropic.com>
[MLIR][Remark] Import LLVM optimization remarks into the remark engine (#222300)
Collect LLVM side of remarks with MLIR's remark infra.
LLVM passes emit their own [optimization
remarks](https://llvm.org/docs/Remarks.html) and MLIR has own. This PR
bridges MLIR and LLVM remarks.
`ModuleToObject` installs a `remark::LLVMToMLIRDiagnosticHandler` on the
`llvm::LLVMContext` it compiles with, which imports these remarks into
the remark engine: the category is the LLVM pass name prefixed with
`llvm-`, the LLVM remark name becomes the name, the message is stored
under the `Remark` argument and the structured LLVM arguments are copied
as metrics. The remark filters therefore select LLVM remarks by pass
name, and `llvm-.*` selects all of them.
Assisted by Claude Fable 5.1
---------
Co-authored-by: Claude Fable 5.1 <noreply at anthropic.com>
[MLIR][CMake] Add HEADER_LIBS and document CMake infrastructure
Add HEADER_LIBS as a flat list of literal library targets for generated headers
included without a link relationship. Resolve aliases and forward references,
accept imported libraries as already generated, follow nested HEADER_LIBS and
link interfaces, and reject missing, executable, utility, or generator-
expression entries with configure-time diagnostics. Cyclic header relationships
add only generator leaves and remain safe.
Record links added by mlir_target_link_libraries for the same deferred ordering.
Add explicit, commented HEADER_LIBS edges for every audited header-only include
that is not covered by mlir-generic-headers, and keep this facility a rare
layering escape hatch.
Document dialects, interfaces, passes, PDLL, generated documentation, library
visibility, C API aggregation, tools, exports, standalone consumers, and the
generated-file model. Add a CMake fixture covering cycles, aliases, conditions,
LINK_ONLY, imported and ignored items, post-hoc links, and invalid providers.
[3 lines not shown]
[MLIR] Fix and classify generated-header dependencies
List the TableGen targets owned by each affected library, and add the missing
LLVM generated-header, SPIR-V source-generation, OpenACC/OpenMP generated-input,
and CIR operation/type prerequisites found by clean dependency audits. Correct
two stale copy-paste dependencies and the duplicate CIR link entry.
The Transforms pass declarations and dialect inliner interface are independent
of any dialect. Classify both under mlir-generic-headers, and associate the
inliner interface with MLIRTransformUtils, which publishes InliningUtils.h.
This gives every MLIR library the required ordering without repeated
header-only edges.
Assisted-by: Codex
Assisted-by: Claude Code
Co-Authored-By: Claude Fable 5.1 <noreply at anthropic.com>
[CMake] Propagate generated-header prerequisites through link dependencies
Record each llvm_add_library DEPENDS list independently from the cumulative
LLVM_COMMON_DEPENDS value, and mark public TableGen targets as generated-header
prerequisites. A deferred traversal follows every direct non-INTERFACE link and
transitive link interface, resolves aliases, and conservatively extracts target
candidates from generator expressions.
Add only the resulting generated-header utility targets as compilation-order
prerequisites. Avoiding dependencies on provider libraries keeps mutually
linked static libraries acyclic and works across generators without waiting for
provider archives. Disabled generator-expression arms may generate extra
headers, but cannot introduce a library or object cycle.
Do not link provider libraries directly to object libraries. That approach was
reverted after an ODR regression when LLVM_LINK_LLVM_DYLIB was enabled. Cache
provider closures so repeated link relationships do not repeat the traversal.
Assisted-by: Codex
[2 lines not shown]
[NFC][BOLT][RISCV] Fix call-relocation-pair test after NOP removal (#222308)
The test introduced by https://github.com/llvm/llvm-project/pull/216882
expects temporary NOPs from FixRISCVCalls in the emitted binary.
https://github.com/llvm/llvm-project/pull/221965 marks those NOPs for
removal, causing FileCheck to match trailing alignment padding instead
of the rewritten calls.
This caused the call-relocation-pair.s failure on
[bolt-aarch64-ubuntu-dylib, build
6378](https://lab.llvm.org/buildbot/#/builders/216/builds/6378).
Check emitted calls independently of the temporary NOPs and verify the
forward-call target symbols. Preserve the intermediate-pass NOP checks.
Validation: all five test RUN commands pass with local BOLT builds that
retain and remove the temporary NOPs. The original test reproduces the
reported FileCheck failure with the NOP-removing build.
[SLP]Exclude splat gather subtrees from the store chain retry size
The tree size recorded for a failed store chain attempt gates the
larger-VF retries. The splat gather subtrees are auxiliary to the store
tree and inflated the recorded size, so the deviation check skipped the
VF=4 retry and the chain fell back to VF=2 or scalar.
Reviewers: bababuck, RKSimon
Pull Request: https://github.com/llvm/llvm-project/pull/221241
[X86][ACEV1] Address review comments
- Drop the AMX_TILE dependency; under acev1 enable only the AMX
instructions that ACE v1 actually shares.
- Namespace the ACE-invented intrinsics under llvm.x86.acev1.* and leave
the shared AMX-AVX512 ones in the flat llvm.x86.* namespace.
- Sync the public intrinsic and builtin names with GCC, and add the
helper macros from the ACE v1 spec.
- Tighten Sema checking of the outer-product group bits, and add driver,
preprocessor and feature-error test coverage.
- Spell BSR0 literally in the AsmStrings with Defs/Uses instead of
carrying it as a custom operand, which removes the bespoke handling
from X86AsmParser and both instruction printers.
- Drop the unused BSR register class; like TMMCFG, BSR0 needs only its
X86Reg definition and the getReservedRegs entry.
- Adopt the operand-type record naming convention, 't' for a TILE and
'e' for a GR32 index, on both the instructions and their pseudos,
retiring the ad-hoc _REG suffix.
- Use WriteSystem rather than WriteVecLogic for the tile outer products
[3 lines not shown]
[MLIR][CMake] Remove aggregate generated-header ordering
Remove the broad mlir-headers prerequisites now that direct links and
HEADER_LIBS relationships provide generated-header ordering.
Keep own generators and intentional source-generation dependencies explicit.
Document migration options for downstream projects that relied on aggregate
ordering.
Assisted-by: Codex
Assisted-by: Claude Code
Co-Authored-By: Claude Fable 5.1 <noreply at anthropic.com>
[MLIR][CMake] Add HEADER_LIBS and document CMake infrastructure
Add HEADER_LIBS as a flat list of literal library targets for generated headers
included without a link relationship. Resolve aliases and forward references,
accept imported libraries as already generated, follow nested HEADER_LIBS and
link interfaces, and reject missing, executable, utility, or generator-
expression entries with configure-time diagnostics. Cyclic header relationships
add only generator leaves and remain safe.
Record links added by mlir_target_link_libraries for the same deferred ordering.
Add explicit, commented HEADER_LIBS edges for every audited header-only include
that is not covered by mlir-generic-headers, and keep this facility a rare
layering escape hatch.
Document dialects, interfaces, passes, PDLL, generated documentation, library
visibility, C API aggregation, tools, exports, standalone consumers, and the
generated-file model. Add a CMake fixture covering cycles, aliases, conditions,
LINK_ONLY, imported and ignored items, post-hoc links, and invalid providers.
[3 lines not shown]
[MLIR] Fix and classify generated-header dependencies
List the TableGen targets owned by each affected library, and add the missing
LLVM generated-header, SPIR-V source-generation, OpenACC/OpenMP generated-input,
and CIR operation/type prerequisites found by clean dependency audits. Correct
two stale copy-paste dependencies and the duplicate CIR link entry.
The Transforms pass declarations and dialect inliner interface are independent
of any dialect. Classify both under mlir-generic-headers, and associate the
inliner interface with MLIRTransformUtils, which publishes InliningUtils.h.
This gives every MLIR library the required ordering without repeated
header-only edges.
Assisted-by: Codex
Assisted-by: Claude Code
Co-Authored-By: Claude Fable 5.1 <noreply at anthropic.com>
[CMake] Propagate generated-header prerequisites through link dependencies
Record each llvm_add_library DEPENDS list independently from the cumulative
LLVM_COMMON_DEPENDS value, and mark public TableGen targets as generated-header
prerequisites. A deferred traversal follows every direct non-INTERFACE link and
transitive link interface, resolves aliases, and conservatively extracts target
candidates from generator expressions.
Add only the resulting generated-header utility targets as compilation-order
prerequisites. Avoiding dependencies on provider libraries keeps mutually
linked static libraries acyclic and works across generators without waiting for
provider archives. Disabled generator-expression arms may generate extra
headers, but cannot introduce a library or object cycle.
Do not link provider libraries directly to object libraries. That approach was
reverted after an ODR regression when LLVM_LINK_LLVM_DYLIB was enabled. Cache
provider closures so repeated link relationships do not repeat the traversal.
Assisted-by: Codex
[2 lines not shown]