================
@@ -1449,6 +1449,41 @@ cir::CleanupScopeOp::getSuccessorInputs(RegionSuccessor
successor) {
return ValueRange();
}
+LogicalResult cir::CleanupScopeOp::canonicalize(CleanupScopeOp op,
+ PatternRewriter &rewriter) {
+ auto isRegionTrivial = [](Region ®ion) {
+ if (!region.hasOneBlock())
+ return false;
+ Block &block = region.front();
+ return llvm::hasSingleElement(block) && isa<cir::YieldOp>(block.front());
----------------
andykaylor wrote:
An added benefit of `getSingleElement` is that it asserts that there is one and
only one element. I changed `region.front()` to use that too.
https://github.com/llvm/llvm-project/pull/191084
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits