[AMDGPU] Fix invalid 64-bit DPP formed from folding a 32-bit DPP mov (#222216)
GCNDPPCombine already rejects 64-bit DPP when the DPP move itself is
64-bit, but a 32-bit move folded into a source of a 64-bit instruction
was not checked. On targets without FeatureDPALU_DPP this formed
V_LSHLREV_B64_e64_dpp, whose tied old operand got the move's 32-bit
register class instead of the 64-bit destination class.
[flang] Avoid signed integer overflow in GetNonNegativeExtent (#222207)
`GetNonNegativeExtent()` computes a dimension's extent from constant
bounds as `ub - lb + 1` in `ConstantSubscript` (`int64_t`) arithmetic.
For an oversized dimension such as `integer(1) ::
a(0_8:9223372036854775807_8)`, whose extent is 2\*\*63, that computation
overflows — undefined behavior, and the ubsan failure reported in
#221940.
The wrapped result has to be preserved: storage sequences that are too
large are diagnosed later, while offsets are computed, and that code
tells a genuinely empty dimension from one whose extent wrapped around
by cross-checking the original bounds (`IsEmptyDimension()` in
`Semantics/compute-offsets.cpp`). This patch therefore computes the same
two's complement result with `llvm::SubOverflow()` and
`llvm::AddOverflow()`, which are defined for every input. Subtracting
first also covers bounds of mixed sign, where `ub - lb` can overflow
before the increment.
[2 lines not shown]
[MLIR] Narrow generated-header prerequisites
Forward-declare IteratorType in TilingInterface.h instead of including all
structured-operation utilities. Include those utilities directly in SCF and
Tensor implementations that use their enum values and helpers, and remove
TilingInterface's dependency on the DialectUtils library.
Replace whole-library prerequisites with the specific Arith and GPU interface
generators. Drop VCIX's obsolete GPU prerequisite, and record the precise Ptr,
SPIR-V, Bufferization and Transform generators required by header consumers.
Pass Rewrite's conditional PDL links through add_mlir_library instead of
adding them afterward, so dependency and aggregation metadata see the same
links while preserving the PDL-disabled configuration.
Validate 289 TilingInterface clients without PCH, compile 13 affected source
files to objects, and compile Rewrite with PDL disabled. Configure both normal
and libMLIR-dylib builds and inspect the resulting dependency graph.
Assisted-by: Codex
[SPIR-V] Fix legalization rewriting non-zero size arrays to pointers (#222276)
legalizeType checked `isa<ArrayType>` with no size guard
Use `shouldLegalizeInstType`, which already checks for zero size
[SPIR-V] Fix legalized store of single element vector to vector (#222253)
A `<1 x T>` shares its SPIR-V type with the scalar T, so extracting from
it emits OpCompositeExtract on a non-composite, which is rejected by
spirv-val
[MLIR] Remove unnecessary generated-header include dependencies (NFC) (#222349)
Remove unused dialect and transform headers, and replace broad pass
aggregates with the specific conversion headers used by GPU and
SparseTensor pipelines. Include the core pass and IR builder definitions
directly where unrelated dialect headers previously supplied them
transitively.
These include-only changes avoid unnecessary TableGen header
prerequisites without depending on changes to the CMake generated-header
dependency model.
Assisted-by: Codex
[CIR][CMake] Configure MLIR as a dependency-only project
ClangIR requires MLIR, but enabling CIR currently requires users to list MLIR
explicitly in LLVM_ENABLE_PROJECTS. That also attaches unrelated MLIR build,
install, unit-test, and lit targets to LLVM aggregates.
When Clang and CIR are selected, append MLIR to the effective project list
and mark it dependency-only. An explicit MLIR selection retains its normal
build, test, and install behavior.
Export and install only MLIR targets reachable from the Clang SDK, together
with the headers needed by those targets. Enable MLIR test-support libraries
when CIR tests need them without registering the MLIR test suite.
Keep the existing standalone ClangIR restriction, and leave MLIR disabled
when CIR is disabled.
Validation:
- Configured Clang with CIR and implicit dependency-only MLIR.
[5 lines not shown]
[CMake] Limit implicit Flang dependency projects
Flang automatically enables MLIR and Clang, but treating those projects as
ordinary enabled projects pulls unrelated tools and tests into aggregate
targets.
Track dependency-only projects explicitly when expanding the requested project
list. Add those projects with EXCLUDE_FROM_ALL, disable their test suites by
default, and keep forwarding only the requested roots to nested builds. Capture
the roots before creating the cache entry so parent-scoped configurations keep
working.
Compute the transitive Clang and MLIR target closure needed by Flang's installed
binaries and CMake package. Promote exactly that closure into the default build
and install it with the required headers, compiler resources, and
clang-linker-wrapper. Do not install the standalone Clang or MLIR packages.
Split MLIR test support libraries from MLIR's own test suite so Flang tests can
use them without registering MLIR tests. Explicitly listing Clang or MLIR keeps
[3 lines not shown]
[CIR][AArch64] Port f64 tests for v8.5 rounding NEON builtins (#221389)
Related to https://github.com/llvm/llvm-project/issues/185382
Port tests from
clang/test/CodeGen/AArch64/v8.5a-neon-frint3264-intrinsic.c to
clang/test/CodeGen/AArch64/neon/rounding-v8.5.c
[CIR] Forward a byref argument loaded from a byref parameter (#221057)
When a callee argument comes out of the calling function's own byref
parameter, that pointer already names the object its caller will
destroy, so pass it along as-is.
Assisted-by: Cursor / claude-opus-5
[llvm-pdbutil] Map enums in bitflags for symbols in YAML (#215887)
Both `S_COMPILE3` and `S_FRAMEPROC` have bitflags that also contain
non-bitflag enums. For `S_COMPILE3`, the lower eight bits represent the
language and for `S_FRAMEPROC` there are bits in the middle representing
the frame pointer registers for variables and parameters.
In both cases, the values of the enums were not present in the generated
YAML.
Mapping this in YAML is a bit complicated, because we can't give
`yaml::IO` a reference to the flags. I used local variables and a check
if we're reading to re-assemble the flags.
[VPlan] Cost scalar IV steps in replicate regions. (#221995)
Replace the return 0 bail-out in VPScalarIVStepsRecipe::computeCost in
replicate regions by properly scaling by the execution probability of
the region.
PR: https://github.com/llvm/llvm-project/pull/221995
[MLIR] Remove unnecessary generated-header include dependencies
Remove unused dialect and transform headers, and replace broad pass aggregates
with the specific conversion headers used by GPU and SparseTensor pipelines.
Include the core pass and IR builder definitions directly where unrelated
dialect headers previously supplied them transitively.
These include-only changes avoid unnecessary TableGen header prerequisites
without depending on changes to the CMake generated-header dependency model.
Compile all ten affected translation units with PCH disabled in a fresh build
configured from this checkout. Check compiler dependency output to confirm
the eliminated provider header families are no longer included.
Assisted-by: Codex
[CGP] Drop poison generating flags when pushing freeze through cmp (#222314)
We need to clear the samesign flag when pushing freeze through icmp.
In the last commit, I also adjusted the handling of FMF on fcmp to work
the same way -- previously the transform would be skipped instead if the
fcmp had fast math flags. I think just clearing the poison-generating
flags is preferable (and what we'd do anyway in InstCombine and
DAGCombine).
Fixes https://github.com/llvm/llvm-project/issues/222309.
[CIR][CMake] Configure MLIR as a dependency-only project
ClangIR requires MLIR, but enabling CIR currently requires users to list MLIR
explicitly in LLVM_ENABLE_PROJECTS. That also attaches unrelated MLIR build,
install, unit-test, and lit targets to LLVM aggregates.
When Clang and CIR are selected, append MLIR to the effective project list
and mark it dependency-only. An explicit MLIR selection retains its normal
build, test, and install behavior.
Export and install only MLIR targets reachable from the Clang SDK, together
with the headers needed by those targets. Enable MLIR test-support libraries
when CIR tests need them without registering the MLIR test suite.
Keep the existing standalone ClangIR restriction, and leave MLIR disabled
when CIR is disabled.
Validation:
- Configured Clang with CIR and implicit dependency-only MLIR.
[5 lines not shown]
X86: Remove stale EFLAGS live range when converting ADD to LEA (#222029)
convertToThreeAddress may rewrite an EFLAGS-clobbering ADD into an LEA,
which does not define EFLAGS. hasLiveCondCodeDef guarantees the EFLAGS def
was dead, so drop its LiveIntervals value, otherwise the verifier would fail.
Fixes verifier errors with -early-live-intervals.
Co-authored-by: Claude (Claude-Opus-4.8)
[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>
[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]
[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]
[gold] Don't hardcode section index in test (#222339)
This can either be 1 or 2 depending on whether binutils was
compiled with --enable-rosegment=yes. The test does not care
about the index (only the address), so make it a wildcard.
[openmp] - Remove hwloc INSTALL_INTERFACE on omp target (#218923)
Reasons for removal:
1. hwloc is not present in installed headers, therefore a consumer of
openmp does not need hwloc
2. There is no omp target exported currently, which means
INSTALL_INTERFACE is ignored.
3. If there is a future omp target exported then there is a possible
relocation issue if LIBOMP_HWLOC_INCLUDE_DIR differs in build
environment vs end user's environment.
We need to keep BUILD_INTERFACE for unit testing and ompd build.
Originally introduced in https://reviews.llvm.org/D123888