@@ -169,12 +169,11 @@ cir::CallOp CIRGenFunction::emitCoroIDBuiltinCall(mlir::Location loc,
169169
170170 cir::FuncOp fnOp;
171171 if (!builtin) {
172- fnOp = CGM.createCIRFunction (
172+ fnOp = CGM.createCIRBuiltinFunction (
173173 loc, CGM.builtinCoroId ,
174174 cir::FuncType::get ({int32Ty, VoidPtrTy, VoidPtrTy, VoidPtrTy}, int32Ty),
175175 /* FD=*/ nullptr );
176176 assert (fnOp && " should always succeed" );
177- fnOp.setBuiltinAttr (mlir::UnitAttr::get (&getMLIRContext ()));
178177 } else
179178 fnOp = cast<cir::FuncOp>(builtin);
180179
@@ -191,11 +190,10 @@ cir::CallOp CIRGenFunction::emitCoroAllocBuiltinCall(mlir::Location loc) {
191190
192191 cir::FuncOp fnOp;
193192 if (!builtin) {
194- fnOp = CGM.createCIRFunction (loc, CGM.builtinCoroAlloc ,
195- cir::FuncType::get ({int32Ty}, boolTy),
196- /* FD=*/ nullptr );
193+ fnOp = CGM.createCIRBuiltinFunction (loc, CGM.builtinCoroAlloc ,
194+ cir::FuncType::get ({int32Ty}, boolTy),
195+ /* FD=*/ nullptr );
197196 assert (fnOp && " should always succeed" );
198- fnOp.setBuiltinAttr (mlir::UnitAttr::get (&getMLIRContext ()));
199197 } else
200198 fnOp = cast<cir::FuncOp>(builtin);
201199
@@ -211,12 +209,11 @@ CIRGenFunction::emitCoroBeginBuiltinCall(mlir::Location loc,
211209
212210 cir::FuncOp fnOp;
213211 if (!builtin) {
214- fnOp = CGM.createCIRFunction (
212+ fnOp = CGM.createCIRBuiltinFunction (
215213 loc, CGM.builtinCoroBegin ,
216214 cir::FuncType::get ({int32Ty, VoidPtrTy}, VoidPtrTy),
217215 /* FD=*/ nullptr );
218216 assert (fnOp && " should always succeed" );
219- fnOp.setBuiltinAttr (mlir::UnitAttr::get (&getMLIRContext ()));
220217 } else
221218 fnOp = cast<cir::FuncOp>(builtin);
222219
@@ -232,12 +229,11 @@ cir::CallOp CIRGenFunction::emitCoroEndBuiltinCall(mlir::Location loc,
232229
233230 cir::FuncOp fnOp;
234231 if (!builtin) {
235- fnOp =
236- CGM. createCIRFunction ( loc, CGM.builtinCoroEnd ,
237- cir::FuncType::get ({VoidPtrTy, boolTy}, boolTy),
238- /* FD=*/ nullptr );
232+ fnOp = CGM. createCIRBuiltinFunction (
233+ loc, CGM.builtinCoroEnd ,
234+ cir::FuncType::get ({VoidPtrTy, boolTy}, boolTy),
235+ /* FD=*/ nullptr );
239236 assert (fnOp && " should always succeed" );
240- fnOp.setBuiltinAttr (mlir::UnitAttr::get (&getMLIRContext ()));
241237 } else
242238 fnOp = cast<cir::FuncOp>(builtin);
243239
@@ -252,7 +248,7 @@ CIRGenFunction::emitCoroutineBody(const CoroutineBodyStmt &S) {
252248
253249 auto Fn = dyn_cast<cir::FuncOp>(CurFn);
254250 assert (Fn && " other callables NYI" );
255- Fn.setCoroutineAttr ( mlir::UnitAttr::get (& getMLIRContext ()) );
251+ Fn.setCoroutine ( true );
256252 auto coroId = emitCoroIDBuiltinCall (openCurlyLoc, nullPtrCst);
257253 createCoroData (*this , CurCoro, coroId);
258254
0 commit comments