[clang] [CIR] Introduce LocalInitOp, & lower static locals (PR #193576)

Henrich Lauko via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 22 23:57:50 PDT 2026


================
@@ -287,15 +342,25 @@ struct LoweringPreparePass
       assert(!cir::MissingFeatures::guardAbortOnException());
 
       // Emit the initializer and add a global destructor if appropriate.
-      auto &ctorRegion = globalOp.getCtorRegion();
-      assert(!ctorRegion.empty() && "This should never be empty here.");
-      if (!ctorRegion.hasOneBlock())
-        llvm_unreachable("Multiple blocks NYI");
-      mlir::Block &block = ctorRegion.front();
       mlir::Block *insertBlock = builder.getInsertionBlock();
-      insertBlock->getOperations().splice(insertBlock->end(),
-                                          block.getOperations(), block.begin(),
-                                          std::prev(block.end()));
+      if (!ctorRegion.empty()) {
+        if (!ctorRegion.hasOneBlock())
+          globalOp->emitError("NYI: ctor region with multiple blocks");
----------------
xlauko wrote:

isn't this enforced by `MaxSizedRegion<1>`?

https://github.com/llvm/llvm-project/pull/193576


More information about the cfe-commits mailing list