]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libgomp/59194 (tsan detects race for real variables in an OMP reduction clause)
authorJakub Jelinek <jakub@redhat.com>
Mon, 13 Jan 2014 07:56:40 +0000 (08:56 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 13 Jan 2014 07:56:40 +0000 (08:56 +0100)
PR libgomp/59194
* omp-low.c (expand_omp_atomic_pipeline): Expand the initial
load as __atomic_load_N if possible.

From-SVN: r206572

gcc/ChangeLog
gcc/omp-low.c

index 5a1f66a19843f28ee183e3314cfe75a9270d57c5..5c1769b3f9f2d3d930349f75a23bc50e6f56b8f5 100644 (file)
@@ -1,3 +1,9 @@
+2014-01-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR libgomp/59194
+       * omp-low.c (expand_omp_atomic_pipeline): Expand the initial
+       load as __atomic_load_N if possible.
+
 2014-01-11  David Edelsohn  <dje.gcc@gmail.com>
 
        * config/rs6000/rs6000.c (rs6000_expand_mtfsf_builtin): Remove
index 05513ee5b9bd0ab1662951dfee9c62598f16b918..5a09b33b2d3db9ee3c907a958ec6584e6c6b1cd6 100644 (file)
@@ -7536,12 +7536,21 @@ expand_omp_atomic_pipeline (basic_block load_bb, basic_block store_bb,
       loadedi = loaded_val;
     }
 
+  fncode = (enum built_in_function) (BUILT_IN_ATOMIC_LOAD_N + index + 1);
+  tree loaddecl = builtin_decl_explicit (fncode);
+  if (loaddecl)
+    initial
+      = fold_convert (TREE_TYPE (TREE_TYPE (iaddr)),
+                     build_call_expr (loaddecl, 2, iaddr,
+                                      build_int_cst (NULL_TREE,
+                                                     MEMMODEL_RELAXED)));
+  else
+    initial = build2 (MEM_REF, TREE_TYPE (TREE_TYPE (iaddr)), iaddr,
+                     build_int_cst (TREE_TYPE (iaddr), 0));
+
   initial
-    = force_gimple_operand_gsi (&si,
-                               build2 (MEM_REF, TREE_TYPE (TREE_TYPE (iaddr)),
-                                       iaddr,
-                                       build_int_cst (TREE_TYPE (iaddr), 0)),
-                               true, NULL_TREE, true, GSI_SAME_STMT);
+    = force_gimple_operand_gsi (&si, initial, true, NULL_TREE, true,
+                               GSI_SAME_STMT);
 
   /* Move the value to the LOADEDI temporary.  */
   if (gimple_in_ssa_p (cfun))