[Mlir-commits] [mlir] [mlir][IR] Fix `Block::without_terminator` for blocks without terminator (PR #154498)
Mehdi Amini
llvmlistbot at llvm.org
Wed Aug 20 07:03:28 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>();
+}
----------------
joker-eph wrote:
I think it still make sense to keep whatever we can in the header to allow inlining of simple things and elimination of redundant checks.
https://github.com/llvm/llvm-project/pull/154498
More information about the Mlir-commits
mailing list