[CI] Check Linux premerge build dependencies with Ninja
Run missingdeps after the Linux build and tests to detect missing
dependency paths to generated files. Include the selected check targets
alongside all.
Assisted-by: Codex
[Flang][CMake] Fix generated-header ordering and binding header copies
FIRBuilder's Runtime/Intrinsics.cpp needs the OpenACC generated headers,
and LowerWorkdistribute.cpp includes the FIR transform pass
declarations. Add acc_gen and FIROptTransformsPassIncGen to their
consuming libraries.
ISO_Fortran_binding.h is a checked-in header. Copying it with
configure_file makes CMake emit a phony rule for the input, which
Ninja's missingdeps mistakes for a generated file without a dependency
path to its consumers. Move both copies to build rules with an explicit
source dependency. Build them by default and before the Flang driver and
flang-headers target. Header edits update both copies without requiring
CMake reconfiguration.
Rebuilt all reported Flang objects and verified ninja -t missingdeps is
clean. Checked header updates and deleted-copy recovery with Ninja, Unix
Makefiles, and Ninja Multi-Config.
Assisted-by: Codex
[LLVM][CMake] Add generated-header dependencies to pass plugins
The example and unit-test plugins include PassBuilder.h, which pulls in
TargetLibraryInfo.inc and GenVT.inc. They rely on the host process for
LLVM symbols, so linking LLVM component libraries does not order these
headers.
Declare analysis_gen and vt_gen alongside intrinsics_gen. Keep the unit
plugins' prerequisites on their library declarations, so they also apply
to any object libraries created for those targets.
Validated by rebuilding all six reported plugin objects and running
ninja -t missingdeps on them.
Assisted-by: Codex
[CI] Check Linux premerge build dependencies with Ninja
Run missingdeps after the Linux build and tests to detect missing
dependency paths to generated files. Include the selected check targets
alongside all.
Assisted-by: Codex
[Flang][CMake] Fix generated-header ordering and binding header copies
FIRBuilder's Runtime/Intrinsics.cpp needs the OpenACC generated headers,
and LowerWorkdistribute.cpp includes the FIR transform pass
declarations. Add acc_gen and FIROptTransformsPassIncGen to their
consuming libraries.
ISO_Fortran_binding.h is a checked-in header. Copying it with
configure_file makes CMake emit a phony rule for the input, which
Ninja's missingdeps mistakes for a generated file without a dependency
path to its consumers. Move both copies to build rules with an explicit
source dependency. Build them by default and before the Flang driver and
flang-headers target. Header edits update both copies without requiring
CMake reconfiguration.
Rebuilt all reported Flang objects and verified ninja -t missingdeps is
clean. Checked header updates and deleted-copy recovery with Ninja, Unix
Makefiles, and Ninja Multi-Config.
Assisted-by: Codex
[MLIR][CMake] Add missing LLVM header generation prerequisites
OptUtils.cpp includes TargetLibraryInfo.inc through LLVM analysis
headers. LLVMRemarkImport.cpp includes Attributes.inc through LLVM IR
headers. Their object libraries do not inherit ordering from
LINK_COMPONENTS.
Add analysis_gen to MLIRExecutionEngineUtils and intrinsics_gen to
MLIRRemarkStreamer so each header is generated before its consumer
builds.
Rebuilt both reported objects and verified ninja -t missingdeps is
clean.
Assisted-by: Codex
[LLVM][CMake] Add generated-header dependencies to pass plugins
The example and unit-test plugins include PassBuilder.h, which pulls in
TargetLibraryInfo.inc and GenVT.inc. They rely on the host process for
LLVM symbols, so linking LLVM component libraries does not order these
headers.
Declare analysis_gen and vt_gen alongside intrinsics_gen. Keep the unit
plugins' prerequisites on their library declarations, so they also apply
to any object libraries created for those targets.
Validated by rebuilding all six reported plugin objects and running
ninja -t missingdeps on them.
Assisted-by: Codex
[VectorCombine] Fix crash on bitcasts of pointer vectors (#246660)
foldBitcastShuffle divides by the scalar sizes of the source and
destination element types, which are zero for pointers. A bitcast of a
shuffled pointer vector, or one between a byte vector and a pointer
vector, then crashes with a division by zero. Take the sizes from the
DataLayout, so these bitcasts are folded too.
The fold also looks through the bitcasts of the shuffle operands, and
some sources can't be bitcast to the new shuffle type, e.g. an integer
vector to a pointer vector ("Invalid cast!"). For such a source,
bitcast the operand itself. Don't fold if that leaves no operand looked
through, which is always the case for a unary shuffle: the new bitcast
of a bitcast can be turned back into the original form by
foldShuffleToIdentity, which loops for repeat and extract masks.
Fixes #246659
Assisted-by: Claude Code (Claude Opus 5.5)
[CIR][flang][CMake] Migrate generated-header dependencies
Replace CIR's mlir-headers dependencies and Flang's global MLIR library
lists with actual library dependencies. Declare public header ownership
and keep source shards, bytecode and lowering tables private. Scope
accumulated TableGen variables before public header generators.
CIRLowering.inc is no longer generated by install-clang-headers; only
transform/lowering sources include it and each consumer lists
CIRLowering. Keep the bytecode block and remove the unnecessary lowering
block. clangFrontendTool links CIR libraries privately, reducing
obj.clangInterpreter's prerequisite edges from 579 at the base to 535
while obj.clangFrontendTool stays at 888.
InitFIR.h no longer includes mlir/InitAllDialects.h or
mlir/Conversion/Passes.h. Include the dialect and pass headers actually
registered and call mlir::registerPass directly for six conversions,
preserving the registration set. LowerWorkdistribute.cpp includes the
OpenMP pass header instead of the general optimizer pass header. Test
[16 lines not shown]
[MLIR][CMake] Stop depending on mlir-generic-headers by default
Remove the default mlir-generic-headers dependency from ordinary and
example libraries. Migrate generated-interface requirements to library
owners, including the 17 requirements deferred from the previous commit.
Keep the compatibility aggregate and registrations.
MLIRIR owns MLIRInferIntRangeInterfaceIncGen for Matchers.h. Add the
Transform/Interfaces generator ordering. MLIRDialectUtils uses the
ArithDialect owner for ReshapeOpsUtils.h. Forward MaskableOpInterface's
compile-only MaskingOpInterface dependency through the local helper so
directly compiled libraries receive a bridge too.
MLIRCAPIIR links MLIRInferTypeOpInterface privately. MLIRPass,
MLIRRewrite and MLIRRewritePDL drop their explicit DEPENDS
mlir-generic-headers.
Extend the release note, guide and aggregate-independence regression to
the generic aggregate and example libraries.
[2 lines not shown]
[MLIR][CMake] Stop depending on mlir-headers by default
Remove the default mlir-headers dependency from the dialect, conversion,
extension and translation library helpers. Keep the aggregate, its
registrations and explicit compatibility dependencies available;
mlir-generic-headers remains a default until the next commit.
Replace redundant foreign generator edges with library links or
compile-only header owners. Add generator-to-generator ordering where
one generated header includes another. Keep 17 requirements already
covered by generic headers or existing links for the next commit; clean
object-library builds pass without them here. GPUBase requirements
remain necessary at this stage.
Keep Rewrite's original PDL library links and remove redundant C API
pass-generator dependencies. Test aggregate independence for the
dialect, conversion, extension and translation helpers.
Add downstream migration guidance, the temporary DEPENDS mlir-headers
[5 lines not shown]
[MLIR][docs] Document the CMake infrastructure
Describe MLIR's TableGen, library, visibility, aggregation, installation
and generated-header conventions in one infrastructure guide. Explain
library owners, explicit generators, compile-only requirements and the
timing of the source-only generator opt-out.
Document raw-link bridge usage, the dependency-optimization caveat and
aggregate defaults at this point in the stack. Link the guide from
CreatingADialect.md.
Assisted-by: Codex
[CMake] Propagate generated headers through link dependencies
llvm_add_library made object libraries wait for whole PUBLIC link
providers to obtain generated headers. Publish marked DEPENDS generators
through the LLVM_GENERATED_HEADERS transitive compile property instead,
and order obj.<name> after the evaluated closure through <name>.headers.
PRIVATE and transitive compile requirements participate without
compiling provider objects.
Use COMPILE_ONLY for another library's headers without its
implementation. Keep these items build-local, and create a bridge for
directly compiled libraries only when such an item is present.
llvm_add_generated_header_bridge covers items added later. Existing
Windows PCH variants also wait for the owner's bridge.
Shared libraries republish the interfaces of unkeyed links and
components hidden by shared mode. Explicit PRIVATE component
requirements stay private. Ignore paths, flags and generator expressions
before constructing TARGET_EXISTS. libLLVM, libMLIR and MLIR aggregates
[28 lines not shown]
[ValueTracking] Migrate significant-bits API to SQ (NFC) (#248632)
Migrate the ComputeMaxSignificantBits API to SimplifyQuery for
uniformity with most other APIs. There is a pending TODO around using
the SimplifyQuery API of ComputeNumSignBits, but the question of
safeCtxI is not yet resolved. There is one call-site where functional
changes could be introduced, but llm-based fuzzing was not able to find
a test.
Assisted-by: llm
[AMDGPU] Fix notfe being assembled as tfe in buffer loads
'buffer_load_dword v[1:2], off, s[4:7], s1 notfe' is currently
assembled as its tfe version. In the asm strings of the TFE
variants, tfe is a token, with parseCustomOperand() parsing it
with parseNamedBit() and validateTargetOperandClass() accepting
the resulting operand for the token -- whatever its value.
The fix makes tfe a normal named-bit operand of the real buffer
instructions, like lds. The TFE variants require it to be set and
the buffer loads and stores that have TFE variants accept notfe.
Side effects:
- notfe is now accepted on the buffer loads that have TFE
variants, e.g., 'buffer_load_dword v1, off, s[4:7], s1 notfe',
and rejected on the TFE variants themselves. Previously, it was
only accepted on the TFE variants. tfe on stores is still
rejected.
[6 lines not shown]
Address review comments
Pass the thread id on to a resumed task, make the task state an
enumeration, use static functions rather than an anonymous namespace,
and test a nested untied task, an untied task with dependences and a
tied undeferred task.
Assisted-By: Claude
[SimplifyCFG] Strip DomTree (NFC) (#248854)
The RequireAndPreserveDomTree flag was added to SimplifyCFG six years
ago in e11331795 ([NFCI][SimplifyCFG] Add basic scaffolding for
gradually making the pass DomTree-aware), and there is still no code
using the dominator tree for any optimization benefit. The compile-time
regression incurred by turning on this flag in the default pipeline is
unacceptable, and from our investigation, it is very unlikely that the
DomTree could be used for optimization benefit in SimplifyCFG that
justifies this compile time. Strip this dead code from the tree, while
leaving the option in place for the tests, which will be handled in a
follow-up. There are two users, namely AMDGPUUnifyDivergentExitNodes,
which is trivial to migrate, and DwarfEHPrepare, which requires a
non-trivial change to migrate. The change was heavily assisted by llm.
Ref:
https://llvm-compile-time-tracker.com/compare.php?from=5bb2855f2e888576f2c9a345a2c66ef7d6b4efdd&to=60984dc2ea8b29905d4039adaf0a4a72ad290e1f&stat=instructions:u
Assisted-by: llm
[IR] Maintain use-list order when growing hung-off uses list (#248404)
`std::copy` assigns each operand, which re-adds the `Use` at the front of its
value's use list. So after growing, all of the user's uses come before uses
from other users.
This causes compilation differences when we serialize the IR in the middle of a
compilation and then deserialize again, because when deserializing we allocate
the lists with different capacities, which causes different growth and use-list
orders.
The use-list order matters because there are many cases where we treat the
use-lists as ordered lists rather than sets. E.g. we iterate it a number of
times with an upper bound. In these cases the output differs depending on which
uses we see at the beginning of the list.
[lldb] Restore the siginfo of a thread after evaluating an expression (#236168)
Running an expression changes the siginfo of the thread (afterwards, it
describes the breakpoint trap at the end of the expression). However,
lldb restores the original stop info, so if the thread stopped because
of a signal, we resume it with that signal. The linux kernel sees that
the signal does not match the siginfo, and makes up a new one, so the
signal handler of the inferior gets si_code=SI_USER (and the pid of
lldb-server) instead of the original fault address. If the expression
crashes with the same signal, the handler gets the fault address of the
expression instead. "thread siginfo" shows the same (wrong) data.
This patch makes lldb-server save the siginfo in QSaveRegisterState, and
restore it in QRestoreRegisterState. These packets are there to preserve
the state of the thread across expression evaluation, so this sort of
makes sense, even though siginfo isn't really a register. Gdb doesn't
have these packets, so it saves registers and siginfo client side (`g/G`
and `qXfer:siginfo:read/write`).
[7 lines not shown]
[MLIR][CMake] Add missing LLVM header generation prerequisites
OptUtils.cpp includes TargetLibraryInfo.inc through LLVM analysis
headers. LLVMRemarkImport.cpp includes Attributes.inc through LLVM IR
headers. Their object libraries do not inherit ordering from
LINK_COMPONENTS.
Add analysis_gen to MLIRExecutionEngineUtils and intrinsics_gen to
MLIRRemarkStreamer so each header is generated before its consumer
builds.
Rebuilt both reported objects and verified ninja -t missingdeps is
clean.
Assisted-by: Codex
[CI] Check Linux premerge build dependencies with Ninja
Run missingdeps after the Linux build and tests to detect missing
dependency paths to generated files. Include the selected check targets
alongside all.
Assisted-by: Codex
[Flang][CMake] Fix generated-header ordering and binding header copies
FIRBuilder's Runtime/Intrinsics.cpp needs the OpenACC generated headers,
and LowerWorkdistribute.cpp includes the FIR transform pass
declarations. Add acc_gen and FIROptTransformsPassIncGen to their
consuming libraries.
ISO_Fortran_binding.h is a checked-in header. Copying it with
configure_file makes CMake emit a phony rule for the input, which
Ninja's missingdeps mistakes for a generated file without a dependency
path to its consumers. Move both copies to build rules with an explicit
source dependency. Build them by default and before the Flang driver and
flang-headers target. Header edits update both copies without requiring
CMake reconfiguration.
Rebuilt all reported Flang objects and verified ninja -t missingdeps is
clean. Checked header updates and deleted-copy recovery with Ninja, Unix
Makefiles, and Ninja Multi-Config.
Assisted-by: Codex
[Polly][CMake] Order generated analysis and value-type headers
Polly's object library includes TargetLibraryInfo.inc and GenVT.inc, but
its LLVM link components do not order generation before object
compilation. Add analysis_gen and vt_gen to the pass plugin's explicit
prerequisites.
Rebuilt the four reported Polly objects and verified that ninja -t
missingdeps no longer reports their missing dependency paths.
Assisted-by: Codex
[LLVM][CMake] Add generated-header dependencies to pass plugins
The example and unit-test plugins include PassBuilder.h, which pulls in
TargetLibraryInfo.inc and GenVT.inc. They rely on the host process for
LLVM symbols, so linking LLVM component libraries does not order these
headers.
Declare analysis_gen and vt_gen alongside intrinsics_gen. Keep the unit
plugins' prerequisites on their library declarations, so they also apply
to any object libraries created for those targets.
Validated by rebuilding all six reported plugin objects and running
ninja -t missingdeps on them.
Assisted-by: Codex
[AMDGPU] Support 'lds' as a normal named-bit modifier (#248393)
b49855fc5684 made lds be parsed as a named bit, but in the asm strings
it remained a token, with parseCustomOperand() parsing it with
parseNamedBit() and validateTargetOperandClass() accepting the resulting
operand for the token. nolds was parsed and then dropped without adding
an operand.
This work-around is not needed. The modifier can be a normal named-bit
operand of the real instructions. The LDS DMA instructions require it to
be set and the buffer, global and scratch loads that have LDS DMA
variants accept nolds.
Side effects:
- nolds is now accepted on targets where the LDS DMA variants of the
loads are not available, e.g., buffer_load_dwordx4 before gfx950 and
global and scratch loads on gfx940+. lds is still rejected there. This
is consistent with nogds, which is accepted on targets without GDS.
[16 lines not shown]
[VectorCombine] Fix invalid bitcast after peeking through bitcasts
foldBitcastShuffle looks through the bitcasts of the shuffle operands
and bitcasts their sources to the new shuffle type. Some sources can't
be bitcast to it, e.g. an integer vector to a pointer vector, which
fails with "Invalid cast!". For such a source, bitcast the operand
itself. Don't fold if that leaves no operand looked through, which is
always the case for a unary shuffle: the new bitcast of a bitcast can
be turned back into the original form by foldShuffleToIdentity, which
loops for repeat and extract masks.
Assisted-by: Claude Code (Claude Opus 5.5)
[VectorCombine] Fix crash on bitcasts of pointer vectors
foldBitcastShuffle divides by the scalar sizes of the source and
destination element types, which are zero for pointers. A bitcast of a
shuffled pointer vector, or one between a byte vector and a pointer
vector, then crashes with a division by zero. Take the sizes from the
DataLayout, so these bitcasts are folded too.
Fixes #246659
Assisted-by: Claude Code (Claude Opus 5.5)