[clang] [CIR] Upstream initial for-loop support (PR #132266)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 20 11:55:06 PDT 2025


================
@@ -52,6 +52,15 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
     return cir::BoolAttr::get(getContext(), getBoolTy(), state);
   }
 
+  /// Create a for operation.
+  cir::ForOp createFor(
+      mlir::Location loc,
+      llvm::function_ref<void(mlir::OpBuilder &, mlir::Location)> condBuilder,
----------------
andykaylor wrote:

That's an excellent question. The incubator (and this PR) emits the initialization in front of the `for` op, but it does seem like it is something we would want more tightly associated with the `for` in the emitted CIR.

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


More information about the cfe-commits mailing list