[Flang] Adjust pass plugin support to match Clang (#174006)
- Pass plugins can use LLVM options, matching #173287.
- Pass plugins can run a hook before codegen, matching #171872.
- Pass plugins are now tested whenever they can be built, matching
#171998.
Plugins currently don't work on AIX, tracked in #172203.
[llvm-objdump][NFC] Use EnumEntry from Support (#174155)
Don't duplicate the EnumEntry type in llvm-objdump.
Spliced off from #173868, where this is required to avoid the name
collision.
[BOLT][BTI] Fix assertions checking getNumOperands (#174600)
Several BTI-related functions are checking that a call MCInst has one
non-annotation operand.
This patch changes these checks to use MCPlus::getNumPrimeOperands,
instead of getNumOperands.
Testing:
added annotations to existing gtests to serve as regression
tests. These now also explicitly check getNumOperands and getNumPrimeOperands
usage on the annotated MCInsts.
[Clang] prevent assertion failure by avoiding always-dependent lambdas in constraint-related nested scopes (#173776)
Fixes #172814
---
This patch resolves an issue in which a lambda could be classified as
always-dependent while traversing nested scopes, causing an assertion
failure during capture handling.
Changes in PR #93206 expanded scope-based dependency handling in a way
that could mark certain lambdas as always-dependent when no
template-dependent context was present.
This update refines the criteria for assigning
`LambdaDependencyKind::LDK_AlwaysDependent` and applies it only after
traversal reaches a distinct enclosing function scope with
template-dependent parameters.
Reapply [ConstantInt] Disable implicit truncation in ConstantInt::get() (#171456)
Reapply after additional fixes.
-----
Disable implicit truncation in the ConstantInt constructor by default.
This means that it needs to be passed a signed/unsigned (depending on
the IsSigned flag) value matching the bit width.
The intention is to prevent the recurring bug where people write
something like `ConstantInt::get(Ty, -1)`, and this "works" until `Ty`
is larger than 64-bit and then the value is incorrect due to missing
type extension.
This is the continuation of
https://github.com/llvm/llvm-project/pull/112670, which originally
allowed implicit truncation in this constructor to reduce initial scope
of the change.
[Buildbot][Polly] Move polly-x86_64-linux-test-suite build instructions into main repository (#166809)
Allow the main llvm-project repository to contain the buildbot builder
instructions, instead of storing them in llvm-zorg. The corresponding
llvm-zorg PR is https://github.com/llvm/llvm-zorg/pull/648.
Using polly-x86_64-linux-test-suite as a proof-of-concept because that
builder is currently offline, I am its maintainer, and is easier to
build than an configuration supporting offload. Once the design has been
decided, more builders can follow.
Advantages are:
* It is easier to make changes in the llvm-project repository. There are
more reviewers than for the llvm-zorg repository.
* Buildbot changes can be made in the same PR with changes that require
updating the buildbot, e.g. changing the name of a CMake option.
* Configuration changes take effect immeditately when landing; no
buildbot master restart needed.
* Some builders store a CMake cache file in the llvm-project repository
[36 lines not shown]
[LoopPeel] Peel last iteration to enable load widening
In loops that contain multiple consecutive small loads (e.g., 3 bytes
loading i8's), peeling the last iteration makes it safe to read beyond
the accessed region, enabling the use of a wider load (e.g., i32) for
all other N-1 iterations.
Patterns such as:
```
%a = load i8, ptr %p
%b = load i8, ptr %p+1
%c = load i8, ptr %p+2
...
%p.next = getelementptr i8, ptr %p, 3
```
Can be transformed to:
```
%wide = load i32, ptr %p ; Read 4 bytes
[9 lines not shown]
[MLIR][Python] Forward the name of MLIR types to Python side (#174700)
In this PR, I added a C API for each (upstream) MLIR type to retrieve
its type name (for example, `IntegerType` -> `mlirIntegerTypeGetName()`
-> `"builtin.integer"`), and exposed a corresponding `type_name` class
attribute in the Python bindings (e.g., `IntegerType.type_name` ->
`"builtin.integer"`). This can be used in various places to avoid
hard-coded strings, such as eliminating the manual string in
`irdl.base("!builtin.integer")`.
Note that parts of this PR (mainly mechanical changes) were produced via
GitHub Copilot and GPT-5.2. I have manually reviewed the changes and
verified them with tests to ensure correctness.
[AMDGPU] Modifies cvt and atomic builtin def to take _Float16 for HIP/C++ (#174707)
For cvt and atomic `__builtin_amdgcn_cvt` builtins, using 'x' in the def
to take _Float16 for HIP/C++ and half for OpenCL.
[CI] Add more glob patterns for `mlir:python` label
Right now, some paths for `mlir:python` are missing, which means the right maintainers don’t always get notified. This PR adds those paths.
[C++20] [Modules] Avoid infinite loop when checking TU local exposures (#174704)
Close https://github.com/llvm/llvm-project/issues/174543
The root cause of the problem is that the recursion in the code pattern
triggers infinite loop in the checking process for TU local exposure.
[mlir][emitc] Fix creating pointer from constant array (#162083)
Modify the C++ emitter to detect when an AddressOf op traces back to a const global. If it does, emit a C-style cast `(T*)(&...)` to strip the const qualification.
Revert "[UniformityAnalysis] Remove an incorrect assertion in uniformity analysis (#174117)"
This reverts commit 371fad28244a16f64e707eb8e9889202fdacf85f.
The change only fixes the superficial assertion. The real problem is that bb.3
and bb.4 should not have been identified as joins of bb.5
[C++20] [Modules] Don't update MarkAsUsed information for decls from named modules (#174687)
Declarations from named modules are used naturally. Thet are
declarations in other TU. We don't need to record the information for
updating them.
[mlir] Fix crash in dropRedundantArguments with produced operands. (#172759)
dropRedundantArguments was incorrectly indexing into forwardedOperands
using the block argument index directly. This crashes when the block has
produced operands (generated by the terminator, not forwarded from
predecessors) because forwardedOperands doesn't include them.
The fix checks isOperandProduced() to skip produced arguments and uses
SuccessorOperands::operator[] which handles the offset correctly.