[Mlir-commits] [mlir] 02981c9 - [MLIR][IR] Rename `Block::hasTerminator` to `mightHaveTerminator` (#66870)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Sep 21 07:43:30 PDT 2023
Author: vic
Date: 2023-09-21T16:43:25+02:00
New Revision: 02981c9635f256ae4fb66171633a19eb9326557d
URL: https://github.com/llvm/llvm-project/commit/02981c9635f256ae4fb66171633a19eb9326557d
DIFF: https://github.com/llvm/llvm-project/commit/02981c9635f256ae4fb66171633a19eb9326557d.diff
LOG: [MLIR][IR] Rename `Block::hasTerminator` to `mightHaveTerminator` (#66870)
This `Block` member function introduced in
87d77d3cfb5049b3b3714f95b2e48bbc78d8c5f9 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 <victor.perez at codeplay.com>
Added:
Modified:
mlir/include/mlir/IR/Block.h
mlir/lib/Dialect/Transform/IR/TransformOps.cpp
mlir/lib/IR/Block.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/IR/Block.h b/mlir/include/mlir/IR/Block.h
index 4b50a0aec945c65..3d00c405ead374b 100644
--- a/mlir/include/mlir/IR/Block.h
+++ b/mlir/include/mlir/IR/Block.h
@@ -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.
diff --git a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
index dc004cd14dc0fbf..23284e14461d8f2 100644
--- a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
+++ b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
@@ -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() !=
diff --git a/mlir/lib/IR/Block.cpp b/mlir/lib/IR/Block.cpp
index 029864d9ea47b98..82ea303cf0171f3 100644
--- a/mlir/lib/IR/Block.cpp
+++ b/mlir/lib/IR/Block.cpp
@@ -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>();
}
More information about the Mlir-commits
mailing list