[all-commits] [llvm/llvm-project] 797165: [mlir] Add a generic while/do-while loop to the SC...

ftynse via All-commits all-commits at lists.llvm.org
Wed Nov 4 00:44:45 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 79716559b5acee891d5664315d7862c5b5c1d34f
      https://github.com/llvm/llvm-project/commit/79716559b5acee891d5664315d7862c5b5c1d34f
  Author: Alex Zinenko <zinenko at google.com>
  Date:   2020-11-04 (Wed, 04 Nov 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/SCF/SCFOps.td
    M mlir/include/mlir/IR/OpImplementation.h
    M mlir/lib/Dialect/SCF/SCF.cpp
    M mlir/lib/Interfaces/ControlFlowInterfaces.cpp
    M mlir/lib/Parser/Parser.cpp
    M mlir/test/Dialect/SCF/invalid.mlir
    M mlir/test/Dialect/SCF/ops.mlir

  Log Message:
  -----------
  [mlir] Add a generic while/do-while loop to the SCF dialect

The new construct represents a generic loop with two regions: one executed
before the loop condition is verifier and another after that. This construct
can be used to express both a "while" loop and a "do-while" loop, depending on
where the main payload is located. It is intended as an intermediate
abstraction for lowering, which will be added later. This form is relatively
easy to target from higher-level abstractions and supports transformations such
as loop rotation and LICM.

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


  Commit: 4c0e255c98cc0e7769be9c9b2700d96e76aec99f
      https://github.com/llvm/llvm-project/commit/4c0e255c98cc0e7769be9c9b2700d96e76aec99f
  Author: Alex Zinenko <zinenko at google.com>
  Date:   2020-11-04 (Wed, 04 Nov 2020)

  Changed paths:
    M mlir/lib/Conversion/SCFToStandard/SCFToStandard.cpp
    M mlir/test/Conversion/SCFToStandard/convert-to-cfg.mlir

  Log Message:
  -----------
  [mlir] Add lowering to CFG for WhileOp

The lowering is a straightforward inlining of the "before" and "after" regions
connected by (conditional) branches. This plugs the WhileOp into the
progressive lowering scheme. Future commits may choose to target WhileOp
instead of CFG when lowering ForOp.

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


  Commit: 8475fa6ed6bb27d5abad418a7f77e9430aa825eb
      https://github.com/llvm/llvm-project/commit/8475fa6ed6bb27d5abad418a7f77e9430aa825eb
  Author: Alex Zinenko <zinenko at google.com>
  Date:   2020-11-04 (Wed, 04 Nov 2020)

  Changed paths:
    M mlir/lib/Conversion/SCFToStandard/SCFToStandard.cpp
    M mlir/test/Conversion/SCFToStandard/convert-to-cfg.mlir

  Log Message:
  -----------
  [mlir] Add a simpler lowering pattern for WhileOp representing a do-while loop

When the "after" region of a WhileOp is merely forwarding its arguments back to
the "before" region, i.e. WhileOp is a canonical do-while loop, a simpler CFG
subgraph that omits the "after" region with its extra branch operation can be
produced. Loop rotation from general "while" to "if { do-while }" is left for a
future canonicalization pattern when it becomes necessary.

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


Compare: https://github.com/llvm/llvm-project/compare/3bec07f91fb1...8475fa6ed6bb


More information about the All-commits mailing list