[flang-commits] [flang] [llvm] [mlir] [OpenMPIRBuilder] Emit __atomic_load and __atomic_compare_exchange libcalls for complex types in atomic update (PR #92364)

Kiran Chandramohan via flang-commits flang-commits at lists.llvm.org
Fri May 17 04:23:30 PDT 2024


================
@@ -1640,8 +1640,7 @@ convertOmpAtomicUpdate(omp::AtomicUpdateOp &opInst,
     }
   }
   if (!isRegionArgUsed)
-    return opInst.emitError("no atomic update operation with region argument"
-                            " as operand found inside atomic.update region");
+    shouldEmitLibCall = true;
----------------
kiranchandramohan wrote:

The code here has changed (as you know). 

The code in Clang seems to do the following for this boolean,
```
      UseLibcall = !C.getTargetInfo().hasBuiltinAtomic(
          AtomicSizeInBits, C.toBits(lvalue.getAlignment()));
 ```
 
 We should also probably do something similar and probably delegate this to the OpenMPIRBuilder to decide. If that is not possible then an alternative would be to look at the block argument and if it is a struct then use LibCall.

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


More information about the flang-commits mailing list