From d613f5ab65bbb80c3f5a0a38fef22cb4878c4358 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 26 Dec 2018 11:21:53 -0800 Subject: Refactor MLFunction to contain a StmtBlock for its body instead of inheriting from it. This is necessary progress to squaring away the parent relationship that a StmtBlock has with its enclosing if/for/fn, and makes room for functions to have more than one block in the future. This also removes IfClause and ForStmtBody. This is step 5/n towards merging instructions and statements, NFC. PiperOrigin-RevId: 226936541 --- mlir/lib/IR/Operation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mlir/lib/IR/Operation.cpp') diff --git a/mlir/lib/IR/Operation.cpp b/mlir/lib/IR/Operation.cpp index d3a618d7da5..c946a76a98b 100644 --- a/mlir/lib/IR/Operation.cpp +++ b/mlir/lib/IR/Operation.cpp @@ -581,7 +581,7 @@ bool OpTrait::impl::verifyIsTerminator(const Operation *op) { // Verify that the operation is at the end of the respective parent block. if (auto *stmt = dyn_cast(op)) { StmtBlock *block = stmt->getBlock(); - if (!block || !isa(block) || &block->back() != stmt) + if (!block || block->getContainingStmt() || &block->back() != stmt) return op->emitOpError("must be the last statement in the ML function"); } else { const Instruction *inst = cast(op); -- cgit v1.2.3