[all-commits] [llvm/llvm-project] 3e8c69: [flang] Add an example plugin exercising the HLFIR...
Valentin Churavy via All-commits
all-commits at lists.llvm.org
Wed Aug 5 02:13:20 PDT 2026
Branch: refs/heads/users/vchuravy/hlfir-pipeline-plugin-example
Home: https://github.com/llvm/llvm-project
Commit: 3e8c6925cc0b5f40b0d6231a80bef8e5b317a950
https://github.com/llvm/llvm-project/commit/3e8c6925cc0b5f40b0d6231a80bef8e5b317a950
Author: Valentin Churavy <v.churavy at gmail.com>
Date: 2026-08-05 (Wed, 05 Aug 2026)
Changed paths:
M flang/docs/FlangDriver.md
M flang/examples/CMakeLists.txt
A flang/examples/HLFIRPipelinePlugin/CMakeLists.txt
A flang/examples/HLFIRPipelinePlugin/HLFIRPipelinePlugin.cpp
M flang/test/CMakeLists.txt
A flang/test/Examples/fir-opt-pass-plugin.fir
A flang/test/Examples/hlfir-pipeline-plugin.f90
Log Message:
-----------
[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
-emit-llvm, so both callback invocation sites, plus a no-plugin negative check.
It checks -O0 and -O2 because at -O0 the intrinsics reach both extension points,
while at -O2 SimplifyHLFIRIntrinsics has expanded them before the Last one -
which is why both points exist. Examples/fir-opt-pass-plugin.fir covers
--load-pass-plugin and the pass showing up in fir-opt's registry.
Co-Authored-By: Claude Opus 5 <noreply at anthropic.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list