[clang] [OpenACC][CIR] Implement atomic update lowering (PR #164836)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 24 10:46:36 PDT 2025


================
@@ -353,6 +361,50 @@ CIRGenFunction::emitOpenACCAtomicConstruct(const OpenACCAtomicConstruct &s) {
                        s.clauses());
     return mlir::success();
   }
+  case OpenACCAtomicKind::None:
+  case OpenACCAtomicKind::Update: {
+    mlir::Value x = emitLValue(inf.X).getPointer();
+    auto op =
+        mlir::acc::AtomicUpdateOp::create(builder, start, x, /*ifCond=*/{});
+    emitOpenACCClauses(op, s.getDirectiveKind(), s.getDirectiveLoc(),
+                       s.clauses());
+    mlir::LogicalResult res = mlir::success();
+    {
+      mlir::Type argTy = cast<cir::PointerType>(x.getType()).getPointee();
+      mlir::OpBuilder::InsertionGuard guardCase(builder);
+      std::array<mlir::Type, 1> recipeType{argTy};
+      std::array<mlir::Location, 1> recipeLoc{start};
+      auto *recipeBlock = builder.createBlock(
----------------
andykaylor wrote:

```suggestion
      mlir::Block *recipeBlock = builder.createBlock(
```

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


More information about the cfe-commits mailing list