[all-commits] [llvm/llvm-project] e5ded3: [Flang][MLIR][OpenMP] Move host op filtering to th...

Sergio Afonso via All-commits all-commits at lists.llvm.org
Thu Jul 9 03:56:53 PDT 2026


  Branch: refs/heads/users/skatrak/host-filtering-02-move-pass
  Home:   https://github.com/llvm/llvm-project
  Commit: e5ded32ae18ec33959eb2964bb764e549fa569b5
      https://github.com/llvm/llvm-project/commit/e5ded32ae18ec33959eb2964bb764e549fa569b5
  Author: Sergio Afonso <Sergio.AfonsoFumero at amd.com>
  Date:   2026-07-09 (Thu, 09 Jul 2026)

  Changed paths:
    M flang/include/flang/Optimizer/OpenMP/Passes.td
    M flang/lib/Optimizer/OpenMP/CMakeLists.txt
    M flang/lib/Optimizer/OpenMP/FunctionFiltering.cpp
    R flang/lib/Optimizer/OpenMP/HostOpFiltering.cpp
    M flang/lib/Optimizer/Passes/Pipelines.cpp
    M flang/test/Fir/basic-program.fir
    A flang/test/Lower/OpenMP/function-filtering-4.f90
    M flang/test/Lower/OpenMP/host-eval.f90
    R flang/test/Transforms/OpenMP/function-filtering-host-ops.mlir
    M mlir/include/mlir/Dialect/OpenMP/Transforms/Passes.td
    M mlir/lib/Dialect/OpenMP/Transforms/CMakeLists.txt
    A mlir/lib/Dialect/OpenMP/Transforms/HostOpFiltering.cpp
    A mlir/test/Dialect/OpenMP/host-op-filtering.mlir

  Log Message:
  -----------
  [Flang][MLIR][OpenMP] Move host op filtering to the omp dialect

The MLIR pass that removes operations exclusively intended for the host
from OpenMP target offload modules is currently defined as part of
Flang. However, this is a feature that would benefit from being reusable
by other frontends, as removing such operations is a requirement for all
OpenMP target device modules prior to LLVM IR translation.

By moving the `omp-host-op-filtering` pass out of Flang, it had to be
updated to work on a lower-level LLVM dialect-based representation,
rather than FIR. This simplified some of the existing edge cases, such
as `fir.declare` ops and `fir.boxchar` type handling. In addition, new
function arguments are introduced as placeholders and return values from
host-only functions are removed, producing a cleaner result and
simplifying the pass as compared to previously.

As a result of a later execution of this pass, dynamic dispatch of host
functions via dispatch table using `fir.dispatch`, `fir.type_info` and
`fir.dt_entry` ops would break due to the removal of `fir.dt_entry`
operations pointing to deleted host functions, while `fir.dispatch` ops
pointing to the same functions would remain. The `omp-function-filtering`
pass is updated to prevent `fir.dt_entry` from being deleted and let
them point to an undefined symbol. This lets FIR lowering to LLVM work
well enough to get to the host op filtering stage, where any resulting
operations for this host dynamic dispatch are cleaned up.



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