Do not assume Blocks belong to Functions
authorAlex Zinenko <zinenko@google.com>
Tue, 28 May 2019 14:41:17 +0000 (07:41 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Sun, 2 Jun 2019 03:05:21 +0000 (20:05 -0700)
commitc2d105811a7a65e59e7190da417625498b9b59cd
tree065e0e85d7910bfa62eb1883d84af0fe69eeefd1
parent8d703af2f8bd0ff17abb0565c82e3f47b5fc6b0a
Do not assume Blocks belong to Functions

    Fix Block::splitBlock and Block::eraseFromFunction that erronously assume
    blocks belong to functions.  They now belong to regions.  When splitting, new
    blocks should be created in the same region as the existing block.  When
    erasing a block, it should be removed from the region rather than from the
    function body that transitively contains the region.

    Also rename Block::eraseFromFunction to Block::erase for consistency with other
    IR containers.

--

PiperOrigin-RevId: 250278272
mlir/include/mlir/IR/Block.h
mlir/lib/IR/Block.cpp
mlir/lib/Transforms/LowerAffine.cpp