aboutsummaryrefslogtreecommitdiff
path: root/gcc/omp-low.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2014-01-13 08:56:40 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2014-01-13 08:56:40 +0100
commit8175be9a8330acffdff270d5cad85b0d637e8f49 (patch)
tree5bc66d47b8e37f7add33a1760d03efd4927a1641 /gcc/omp-low.c
parent131241a395a9aea1490f1650fc4b79eb1994f360 (diff)
downloadgcc-8175be9a8330acffdff270d5cad85b0d637e8f49.zip
gcc-8175be9a8330acffdff270d5cad85b0d637e8f49.tar.gz
gcc-8175be9a8330acffdff270d5cad85b0d637e8f49.tar.bz2
re PR libgomp/59194 (tsan detects race for real variables in an OMP reduction clause)
PR libgomp/59194 * omp-low.c (expand_omp_atomic_pipeline): Expand the initial load as __atomic_load_N if possible. From-SVN: r206572
Diffstat (limited to 'gcc/omp-low.c')
-rw-r--r--gcc/omp-low.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 05513ee..5a09b33 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -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))