[clang] [CIR] Introduce loop cleanup regions (PR #210212)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 17 14:01:33 PDT 2026


================
@@ -2310,16 +2364,34 @@ def CIR_ForOp : CIR_LoopOpBase<"for"> {
         // Build step region.
         $_builder.createBlock($_state.addRegion());
         stepBuilder($_builder, $_state.location);
+
+        // Build optional cleanup region.
+        mlir::Region *cleanupRegion = $_state.addRegion();
+        if (cleanupBuilder) {
----------------
andykaylor wrote:

I could move it into a shared function, but I expect this to be stable and I'd prefer to leave it here (and above) for one-stop visibility.

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


More information about the cfe-commits mailing list