[Mlir-commits] [mlir] [mlir][IR] Fix `Block::without_terminator` for `NoTerminator` ops (PR #154498)
Matthias Springer
llvmlistbot at llvm.org
Wed Aug 20 05:18:43 PDT 2025
================
@@ -251,6 +251,15 @@ bool Block::mightHaveTerminator() {
return !empty() && back().mightHaveTrait<OpTrait::IsTerminator>();
}
+/// Check whether this block has no terminator.
+bool Block::hasNoTerminator() {
+ if (empty())
+ return true;
+ if (!back().isRegistered())
+ return false;
+ return !back().hasTrait<OpTrait::IsTerminator>();
+}
----------------
matthias-springer wrote:
My original implementation was incorrect. We don't need `hasNoTerminator`, but `hasTerminator`. Does it still make sense to use `hasTerminatorImpl()`?
https://github.com/llvm/llvm-project/pull/154498
More information about the Mlir-commits
mailing list