Skip to content

[MLIR][IR] Rename Block::hasTerminator to mightHaveTerminator #66870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions mlir/include/mlir/IR/Block.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,11 @@ class Block : public IRObjectWithUseList<BlockOperand>,
//===--------------------------------------------------------------------===//

/// Get the terminator operation of this block. This function asserts that
/// the block has a valid terminator operation.
/// the block might have a valid terminator operation.
Operation *getTerminator();

/// Check whether this block has a terminator.
bool hasTerminator();
/// Check whether this block might have a terminator.
bool mightHaveTerminator();

//===--------------------------------------------------------------------===//
// Predecessors and successors.
Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Dialect/Transform/IR/TransformOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2188,7 +2188,7 @@ LogicalResult transform::SequenceOp::verify() {
}
}

if (!getBodyBlock()->hasTerminator())
if (!getBodyBlock()->mightHaveTerminator())
return emitOpError() << "expects to have a terminator in the body";

if (getBodyBlock()->getTerminator()->getOperandTypes() !=
Expand Down
8 changes: 4 additions & 4 deletions mlir/lib/IR/Block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,14 @@ void Block::eraseArguments(function_ref<bool(BlockArgument)> shouldEraseFn) {
//===----------------------------------------------------------------------===//

/// Get the terminator operation of this block. This function asserts that
/// the block has a valid terminator operation.
/// the block might have a valid terminator operation.
Operation *Block::getTerminator() {
assert(hasTerminator());
assert(mightHaveTerminator());
return &back();
}

/// Check whether this block has a terminator.
bool Block::hasTerminator() {
/// Check whether this block might have a terminator.
bool Block::mightHaveTerminator() {
return !empty() && back().mightHaveTrait<OpTrait::IsTerminator>();
}

Expand Down