[mlir] SCF: provide function_ref builders for IfOp
authorAlex Zinenko <zinenko@google.com>
Mon, 25 May 2020 16:55:41 +0000 (18:55 +0200)
committerAlex Zinenko <zinenko@google.com>
Wed, 27 May 2020 14:12:58 +0000 (16:12 +0200)
commitcadb7ccf2cebcaa2d546db77223bde3d69a162af
tree76bdfd7f83aa5db4796da9fac6ddb409772ad69c
parent5ee902bb5f3a843230f45dcd7b8101de71da7c83
[mlir] SCF: provide function_ref builders for IfOp

Now that OpBuilder is available in `build` functions, it becomes possible to
populate the "then" and "else" regions directly when building the "if"
operation. This is desirable in more structured forms of builders, especially
in when conditionals are mixed with loops. Provide new `build` APIs taking
callbacks for body constructors, similarly to scf::ForOp, and replace more
clunky edsc::BlockBuilder uses with these. The original APIs remain available
and go through the new implementation.

Differential Revision: https://reviews.llvm.org/D80527
mlir/include/mlir/Dialect/SCF/EDSC/Builders.h
mlir/include/mlir/Dialect/SCF/SCF.h
mlir/include/mlir/Dialect/SCF/SCFOps.td
mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
mlir/lib/Dialect/SCF/EDSC/Builders.cpp
mlir/lib/Dialect/SCF/SCF.cpp