[MLIR] Add support for defining and using Op specific analysis
authorRahul Joshi <jurahul@google.com>
Fri, 14 Aug 2020 03:43:47 +0000 (20:43 -0700)
committerRahul Joshi <jurahul@google.com>
Mon, 17 Aug 2020 16:00:47 +0000 (09:00 -0700)
commit9a4b30cf84298887f0a7bf70b865493d767abdc9
treea8b06a546a1b3416535d1b9ca9993da46629daba
parent75966ee241a2f1b7712caa1bbe66560347b23359
[MLIR] Add support for defining and using Op specific analysis

- Add variants of getAnalysis() and friends that operate on a specific derived
  operation types.
- Add OpPassManager::getAnalysis() to always call the base getAnalysis() with OpT.
- With this, an OperationPass can call getAnalysis<> using an analysis type that
  is generic (works on Operation *) or specific to the OpT for the pass. Anything
  else will fail to compile.
- Extend AnalysisManager unit test to test this, and add a new PassManager unit
  test to test this functionality in the context of an OperationPass.

Differential Revision: https://reviews.llvm.org/D84897
mlir/include/mlir/Pass/AnalysisManager.h
mlir/include/mlir/Pass/Pass.h
mlir/unittests/Pass/AnalysisManagerTest.cpp
mlir/unittests/Pass/CMakeLists.txt
mlir/unittests/Pass/PassManagerTest.cpp [new file with mode: 0644]