diff --git a/mlir/lib/IR/Verifier.cpp b/mlir/lib/IR/Verifier.cpp --- a/mlir/lib/IR/Verifier.cpp +++ b/mlir/lib/IR/Verifier.cpp @@ -148,7 +148,7 @@ if (failed(verifyOperation(block.back()))) return failure(); if (block.back().isKnownNonTerminator()) - return emitError(block, "block with no terminator"); + return block.back().emitError("block with no terminator"); // Verify that this block is not branching to a block of a different // region. diff --git a/mlir/test/IR/invalid.mlir b/mlir/test/IR/invalid.mlir --- a/mlir/test/IR/invalid.mlir +++ b/mlir/test/IR/invalid.mlir @@ -170,7 +170,8 @@ // ----- func @no_return() { - %x = constant 0 : i32 // expected-error {{block with no terminator}} + %x = constant 0 : i32 + %y = constant 1 : i32 // expected-error {{block with no terminator}} } // -----