[all-commits] [llvm/llvm-project] 359ba0: [mlir][CFGToSCF] Add interface changes for downstr...

Markus Böck via All-commits all-commits at lists.llvm.org
Tue Aug 15 07:40:17 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 359ba0b00806c6fba325733e817637522b8c6e19
      https://github.com/llvm/llvm-project/commit/359ba0b00806c6fba325733e817637522b8c6e19
  Author: Markus Böck <markus.bock+llvm at nextsilicon.com>
  Date:   2023-08-15 (Tue, 15 Aug 2023)

  Changed paths:
    M mlir/include/mlir/Conversion/ControlFlowToSCF/ControlFlowToSCF.h
    M mlir/include/mlir/Transforms/CFGToSCF.h
    M mlir/lib/Conversion/ControlFlowToSCF/ControlFlowToSCF.cpp
    M mlir/lib/Transforms/Utils/CFGToSCF.cpp

  Log Message:
  -----------
  [mlir][CFGToSCF] Add interface changes for downstream projects

This is a follow-up to https://reviews.llvm.org/D156889

Downstream projects may have more complicated ops than the control flow ops upstream and therefore need a more powerful interface to support the lifting process. Use cases include the propagation of (inherent) metadata that was previously on the control flow ops and now needs to be lifted to structured control flow ops.
Since the lifting process is inherently non-local in respect to the function-body, we require stronger guarantees from the interface.

This patch therefore makes two changes to the interface:
* Passes the terminator that is being replaced to `createStructuredBranchRegionTerminatorOp`
* Adds as precondition to `createCFGSwitchOp` that its predecessors are already correctly established

Asserts have been added to verify these were it makes sense and to correctly state intent. I have not added tests purely because testing preconditions like these is not really feasible (and incredibly specific).

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




More information about the All-commits mailing list