forked from OSchip/llvm-project
[MLIR] Flag no-terminator error on the last operation of non-empty blocks
- When a block is not empty and does not end with a terminator, flag the error on the last operation of the block instead of the start of the block. Differential Revision: https://reviews.llvm.org/D90988
This commit is contained in:
parent
e625f9c5d1
commit
c96168975b
|
@ -148,7 +148,7 @@ LogicalResult OperationVerifier::verifyBlock(Block &block) {
|
|||
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.
|
||||
|
|
|
@ -170,7 +170,8 @@ func @block_first_has_predecessor() {
|
|||
// -----
|
||||
|
||||
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}}
|
||||
}
|
||||
|
||||
// -----
|
||||
|
|
Loading…
Reference in New Issue