Skip to content

Commit 02981c9

Browse files
authored
[MLIR][IR] Rename Block::hasTerminator to mightHaveTerminator (#66870)
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 4de93db commit 02981c9

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

mlir/include/mlir/IR/Block.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,11 @@ class Block : public IRObjectWithUseList<BlockOperand>,
211211
//===--------------------------------------------------------------------===//
212212

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

217-
/// Check whether this block has a terminator.
218-
bool hasTerminator();
217+
/// Check whether this block might have a terminator.
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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,14 @@ void Block::eraseArguments(function_ref<bool(BlockArgument)> shouldEraseFn) {
234234
//===----------------------------------------------------------------------===//
235235

236236
/// Get the terminator operation of this block. This function asserts that
237-
/// the block has a valid terminator operation.
237+
/// the block might have a valid terminator operation.
238238
Operation *Block::getTerminator() {
239-
assert(hasTerminator());
239+
assert(mightHaveTerminator());
240240
return &back();
241241
}
242242

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

0 commit comments

Comments
 (0)