[clang] [clang][CodeGen][OpenMP] Fix casting of atomic update of ptr types (PR #88215)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 12 07:20:19 PDT 2024


================
@@ -851,6 +852,16 @@ int main(void) {
 // CHECK: call{{.*}} @__kmpc_flush(
 #pragma omp atomic seq_cst
   rix = dv / rix;
+
+// CHECK: [[LD_CPX:%.+]] = load atomic ptr, ptr @cpx monotonic
+// CHECK: br label %[[CONT:.+]]
+// CHECK: [[CONT]]
+// CHECK: [[PHI:%.+]] = phi ptr
+// CHECK: [[RES:%.+]] = cmpxchg ptr @cpx,
----------------
arsenm wrote:

Do we really end up emitting a cmpxchg in the frontend just because atomicrmw doesn't have pointer typed add? This is horrible 

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


More information about the cfe-commits mailing list