[LLDB] Exclude exposed exe symbols from tests
Same as what we have for normal lldb installation. A executable may
creates a copy of a symbol if it links to the archive. Exclude archive
symbols out from the exe itself.
[flang] Add an example plugin exercising the HLFIR pipeline extension points
The HLFIR extension points, the pipeline config callback registry and fir-opt's
symbol export all exist to let an out-of-tree MLIR pass run while the HLFIR
intrinsic operations (hlfir.sum, hlfir.matmul, ...) are still present. None of
that was covered end to end, and nothing showed how to use it.
Add flang/examples/HLFIRPipelinePlugin, modelled on PrintFlangFunctionNames. It
contributes a pass that prints the HLFIR operations still present in the module,
tagged with the pipeline position it was inserted at, and exposes it through
both plugin entry points: a static initializer calling
fir::registerPassPipelineConfigCallback for the `flang -fc1 -load` path, and
mlirGetPassPluginInfo so fir-opt can load it with --load-pass-plugin.
Nothing is linked into the shared object; MLIR, FIR and flang symbols resolve
against the host tool, which is what export_executable_symbols_for_plugins on
flang and fir-opt provides.
Two tests use it. Examples/hlfir-pipeline-plugin.f90 covers -emit-fir and
[7 lines not shown]
[flang] Address review comments on the HLFIR pipeline example plugin
- Rename the pass to print-hlfir-ops: it prints every hlfir op, not only the
intrinsics.
- Drop the redundant option copy in the copy constructor; Pass::clone copies
option values.
- Tests: drop the no-plugin run, which could not fail, and at -O2 only check
that both extension points are reached rather than what
SimplifyHLFIRIntrinsics chose to expand.
Assisted-by: Claude Code (Opus 5.5)
[NFC][TSan] Remove redundant Context::report_mtx
Context::report_mtx was only ever acquired immediately alongside
ScopedErrorReportLock (in ScopedReport and BackgroundThread). Remove
report_mtx and MutexTypeReport and rely on ScopedErrorReportLock.
Assisted-by: Gemini
Pull Request: https://github.com/llvm/llvm-project/pull/228605
[orc-rt] Use the Error matchers in SimpleRemoteCAOverSocketTest (#228642)
Use the Error matchers introduced in 4c8a437d0487 to clean up error
checks in SimpleRemoteCAOverSocketTest.
[MLIR][arith] Fold or(a, or(a, b)) to or(a, b) (#228386)
`arith.andi` already folds `and(a, and(a, b))` to `and(a, b)`, but
`arith.ori` doesn't perform the equivalent fold, so using canonicalize
misses this opportunity.
Generalize the existing helper and use it for both ops.
Co-authored-by: Matthias Springer <me at m-sp.org>
[gn] port 82290a03b3cc a bit (CASPluginTest) (#228639)
Also disable llvm_enable_ondisk_cas for a bit until I can figure out how
to fix
dlopen(..../out/gn/lib/CASPluginTest.dylib, 0x0009):
symbol not found in flat namespace '__ZN4llvm4SHA15finalEv'
when running llvm/test/tools/llvm-cas lit tests. (The unit test passes.)
[flang] Add a MLIRToLLVMPassPipeline callbacks for plugins (#212195)
Expose the extension points of the HLFIR-to-FIR pass pipeline exposes extension points to plugins.
Follow-up to #212194
Assisted-by: Claude Code (Opus 5, Opus 5.5)
[InstCombine] Fold select of pow into select of the differing operand
When both arms of a select are calls to `llvm.pow` with one use that
differ in exactly one operand, sink the select into that operand:
$$
\mathrm{select}(c,\ x^{y},\ x^{z}) \rightarrow x^{\mathrm{select}(c,\ y,\ z)}
$$
$$
\mathrm{select}(c,\ x^{z},\ y^{z}) \rightarrow \mathrm{select}(c,\ x,\ y)^{z}
$$
This removes one `pow` call. FMF are intersected and debug locations
are merged. The transform is skipped when a differing operand is a
constant, since that may enable a cheaper lowering (e.g.
$x^2 \rightarrow x \cdot x$).
[InstCombine] Add tests for select of pow with one differing operand
Add tests for select between two `llvm.pow` calls whose operands differ in
exactly one position, covering scalar and vector types, FMF, !prof
metadata, constant operands, and negative cases (multiple differing
operands, extra uses, mismatched intrinsics).
[NFC][TSan] Make Context::nreported atomic (#228602)
Make Context::nreported an atomic_uint32_t so that Finalize and
__tsan_report_count can read it without relying on report_mtx.
Assisted-by: Gemini
[mlir] Set WrapNamespaceBodyWithEmptyLines: Never (#221421)
MLIR predominantly writes namespace bodies without a wrapping empty
line: in mlir/lib and mlir/include 35% of bodies start with an empty
line and 32% end with one.
```
namespace ns { // no empty line below
struct A {
};
} // namespace ns // no empty live above
```
New code drifts the other way, partly related to LLM preference. Pin the
majority style using a clang-format 20 feature to stop further damage.
[flang] Add a pass-pipeline config callback hook for plugins
The HLFIR-to-FIR pipeline extension points live on MLIRToLLVMPassPipelineConfig,
which the frontend builds as a local of CodeGenAction, out of reach of a plugin.
Add a process-global registry of callbacks that run on the config before the
pipeline is built. A plugin registers one from a static initializer, so it is in
place before any compilation begins, as FrontendPluginRegistry does for plugin
actions. Both code generation entry points invoke the callbacks, lowerHLFIRToFIR
for -emit-fir and generateLLVMIR for -emit-llvm/-emit-obj, and are mutually
exclusive for a given compilation, so a plugin sees the same behaviour whichever
output was asked for.
Co-Authored-By: Claude Opus 5 <noreply at anthropic.com>
[flang] Address review comments on the pipeline config callbacks
- Adopt the suggested doc comment wording and name the callback type
(PassPipelineConfigCallback) instead of spelling std::function / auto.
- Run the callbacks in generateLLVMIR once the config is fully set up, so a
plugin sees the OpenMP/OpenACC, vscale and other settings as on -emit-fir.
- Document that -emit-fir only reaches the HLFIR extension points, that
callbacks must not register callbacks, and that bbc/tco/fir-opt do not run
the registry.
- Tests: drop the redundant epRan flag and use a plain global recorder.
Assisted-by: Claude Code (Opus 5.5)
[mlir][bufferization] Fix placement walk crashes and invalid captures (#228050)
`findPlacementBlock`, which is shared by `buffer-hoisting` and
`buffer-loop-hoisting`, can move an allocation outside the operation
used to build the liveness analysis. For example, when
`transform.bufferization.buffer_loop_hoisting` targets a `scf.while`,
moving the allocation into the enclosing function block causes the
liveness lookup to crash.
The walk can also cross an `IsIsolatedFromAbove` operation and introduce
an illegal capture, or reach an unreachable enclosing block and
dereference a missing dominator node. The initial reachability check on
the allocation's block doesn't cover that second case.
This PR keeps allocations inside the analysis target and isolated
regions, and stops the walk before querying a dominator node for an
unreachable block. Movement between blocks within the same region
remains allowed.
[15 lines not shown]