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

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 23 19:13:56 PDT 2025


================
@@ -364,13 +377,31 @@ OpenACCAtomicConstruct::getAssociatedStmtInfo() const {
     // type, and 'x' is a scalar l value. As above, this can come in 2 forms;
     // Binary Operator or CXXOperatorCallExpr.
     std::pair<const Expr *, const Expr *> BinaryArgs =
-        getBinaryOpArgs(cast<const Expr>(getAssociatedStmt()));
+        getBinaryOpArgs(AssocStmt);
     // We want the L-value for ONLY the X side, so we ignore implicit casts. For
     // the right side (the expr), we emit it as an r-value so we need to
     // maintain implicit casts.
     return {/*v=*/nullptr, BinaryArgs.first->IgnoreImpCasts(),
             BinaryArgs.second};
   }
+  case OpenACCAtomicKind::None:
+  case OpenACCAtomicKind::Update: {
+    std::pair<bool, const Expr *> UnaryArgs = getUnaryOpArgs(AssocStmt);
+
+    // TODO: ERICH: Figure out what we are going to do to figure out this is an
----------------
erichkeane wrote:

Oh woops!  That comment ended up going stale when I figured out how I was going to do serialization with the little trickery of "create an alloca, save the value, run the expr, then load & yield" thing.  

At the time I thought I was going to have to do some sort of trickery to teach CIR-Gen how to differentiate between the two forms, but the above seems much more robust to me.  Anyway, removed the comment, thanks for the review!

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


More information about the cfe-commits mailing list