================
@@ -679,6 +679,52 @@ cir::LocalInitOp::verifySymbolUses(SymbolTableCollection
&symbolTable) {
return success();
}
+//===----------------------------------------------------------------------===//
+// RegisterExitDtorOp
+//===----------------------------------------------------------------------===//
+
+/// Returns true if \p op is nested in the ctor region of a cir.global or
+/// cir.local_init without crossing a cir.func or a cir.register_exit_dtor.
+static bool isInVarCtorRegion(mlir::Operation *op) {
+ for (mlir::Operation *parent = op->getParentOp(); parent;
+ parent = parent->getParentOp()) {
+ mlir::Region *ctorRegion = nullptr;
+ if (auto global = mlir::dyn_cast<cir::GlobalOp>(parent))
+ ctorRegion = &global.getCtorRegion();
+ else if (auto localInit = mlir::dyn_cast<cir::LocalInitOp>(parent))
+ ctorRegion = &localInit.getCtorRegion();
+ else if (mlir::isa<cir::FuncOp, cir::RegisterExitDtorOp>(parent))
+ return false;
+ if (ctorRegion)
+ return ctorRegion->isAncestor(op->getParentRegion());
+ }
+ return false;
+}
+
+LogicalResult cir::RegisterExitDtorOp::verify() {
+ mlir::Block &body = getBody().front();
----------------
adams381 wrote:
No, it has to be a single block. The op's `SingleBlock` trait already rejects
anything else before `verify()` runs. I added a test to show that a two-block
body fails with the existing check.
https://github.com/llvm/llvm-project/pull/229896
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits