[all-commits] [llvm/llvm-project] 9c9a43: [mlir][Pass] Add support for an InterfacePass and ...

River Riddle via All-commits all-commits at lists.llvm.org
Fri Mar 4 15:14:33 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9c9a4317359e40cca6e1dbf4439c0f5cd1afbd7a
      https://github.com/llvm/llvm-project/commit/9c9a4317359e40cca6e1dbf4439c0f5cd1afbd7a
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2022-03-04 (Fri, 04 Mar 2022)

  Changed paths:
    M mlir/include/mlir/Pass/Pass.h
    M mlir/include/mlir/Pass/PassBase.td
    M mlir/include/mlir/Pass/PassManager.h
    M mlir/lib/Pass/Pass.cpp
    A mlir/test/Pass/interface-pass.mlir
    A mlir/test/Pass/invalid-interface-pass.mlir
    M mlir/test/lib/Pass/TestPassManager.cpp
    M mlir/unittests/Pass/PassManagerTest.cpp

  Log Message:
  -----------
  [mlir][Pass] Add support for an InterfacePass and pass filtering based on OperationName

This commit adds a new hook Pass `bool canScheduleOn(RegisteredOperationName)` that
indicates if the given pass can be scheduled on operations of the given type. This makes it
easier to define constraints on generic passes without a) adding conditional checks to
the beginning of the `runOnOperation`, or b) defining a new pass type that forwards
from `runOnOperation` (after checking the invariants) to a new hook. This new hook is
used to implement an `InterfacePass` pass class, that represents a  generic pass that
runs on operations of the given interface type.

The PassManager will also verify that passes added to a pass manager can actually be
scheduled on that pass manager, meaning that we will properly error when an Interface
is scheduled on an operation that doesn't actually implement that interface.

Differential Revision: https://reviews.llvm.org/D120791




More information about the All-commits mailing list