Add an eager API version for BR and COND_BR
authorNicolas Vasilache <ntv@google.com>
Wed, 6 Mar 2019 15:46:36 +0000 (07:46 -0800)
committerjpienaar <jpienaar@google.com>
Sat, 30 Mar 2019 00:00:26 +0000 (17:00 -0700)
commitee4a80bbd61eb8fa9c9ac408e5066aac201461bc
tree58867e22058fa46b596f52227fd9a824597f2799
parent38f1d2d77e566bee54e10c56c694a30a80d9a611
Add an eager API version for BR and COND_BR

When building unstructured control-flow there is a need to construct mlir::Block* before being able to fill them. This invites goto-style programming.

This CL introduces an alternative eager API for BR and COND_BR in which blocks are created eagerly and captured on the fly.

This allows reducing the number of calls to `BlockBuilder` from 4 to 2 in the `builder_blocks_eager` test and from 3 to 2 in the `builder_cond_branch_eager` test.

PiperOrigin-RevId: 237046114
mlir/include/mlir/EDSC/Intrinsics.h
mlir/lib/EDSC/Intrinsics.cpp
mlir/test/EDSC/builder-api-test.cpp