[all-commits] [llvm/llvm-project] d2b1e4: [flang] Add an example plugin exercising the HLFIR...
Valentin Churavy via All-commits
all-commits at lists.llvm.org
Wed Aug 5 01:41:49 PDT 2026
Branch: refs/heads/users/vchuravy/hlfir-pipeline-plugin-example
Home: https://github.com/llvm/llvm-project
Commit: d2b1e4996002f4ea4b229d0f4213fd0a8205fd54
https://github.com/llvm/llvm-project/commit/d2b1e4996002f4ea4b229d0f4213fd0a8205fd54
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 config augmentor registry and fir-opt's symbol
export 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 there was no worked example of 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. Removing the fir-opt export drops it from ~105k
exported dynamic symbols to one and makes --load-pass-plugin fail to load.
Two tests use it. Examples/hlfir-pipeline-plugin.f90 covers -emit-fir and
-emit-llvm, plus a no-plugin negative check; at -O0 the intrinsics reach both
extension points, while at -O2 SimplifyHLFIRIntrinsics has expanded them before
the Last one, which is why both 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