Skip to content

Commit 3d3db60

Browse files
committed
[MLIR][IR] Rename Block::hasTerminator to mightHaveTerminator()
This `Block` member function introduced in 87d77d3 may be misleading to users as the last operation in the block might have not been registered, so there would be no way to ensure that is a terminator. Signed-off-by: Victor Perez <[email protected]>
1 parent 87f937e commit 3d3db60

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

mlir/include/mlir/IR/Block.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ class Block : public IRObjectWithUseList<BlockOperand>,
215215
Operation *getTerminator();
216216

217217
/// Check whether this block has a terminator.
218-
bool hasTerminator();
218+
bool mightHaveTerminator();
219219

220220
//===--------------------------------------------------------------------===//
221221
// Predecessors and successors.

mlir/lib/Dialect/Transform/IR/TransformOps.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2188,7 +2188,7 @@ LogicalResult transform::SequenceOp::verify() {
21882188
}
21892189
}
21902190

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

21942194
if (getBodyBlock()->getTerminator()->getOperandTypes() !=

mlir/lib/IR/Block.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,12 +236,12 @@ void Block::eraseArguments(function_ref<bool(BlockArgument)> shouldEraseFn) {
236236
/// Get the terminator operation of this block. This function asserts that
237237
/// the block has a valid terminator operation.
238238
Operation *Block::getTerminator() {
239-
assert(hasTerminator());
239+
assert(mightHaveTerminator());
240240
return &back();
241241
}
242242

243243
/// Check whether this block has a terminator.
244-
bool Block::hasTerminator() {
244+
bool Block::mightHaveTerminator() {
245245
return !empty() && back().mightHaveTrait<OpTrait::IsTerminator>();
246246
}
247247

0 commit comments

Comments
 (0)