diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fcec2ad3aab67..fb6181277c50c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2014-03-27 Jakub Jelinek + + PR middle-end/60682 + * omp-low.c (lower_omp_1): For gimple_clobber_p stmts, + if they need regimplification, just drop them instead of + calling gimple_regimplify_operands on them. + 2014-03-27 Marcus Shawcroft PR target/60580 diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 7cc398ea5c099..11bb2d35a151a 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -10124,7 +10124,20 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context *ctx) if ((ctx || task_shared_vars) && walk_gimple_op (stmt, lower_omp_regimplify_p, ctx ? NULL : &wi)) - gimple_regimplify_operands (stmt, gsi_p); + { + /* Just remove clobbers, this should happen only if we have + "privatized" local addressable variables in SIMD regions, + the clobber isn't needed in that case and gimplifying address + of the ARRAY_REF into a pointer and creating MEM_REF based + clobber would create worse code than we get with the clobber + dropped. */ + if (gimple_clobber_p (stmt)) + { + gsi_replace (gsi_p, gimple_build_nop (), true); + break; + } + gimple_regimplify_operands (stmt, gsi_p); + } break; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fd9149e9cbd33..c2a13d9493132 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-03-27 Jakub Jelinek + + PR middle-end/60682 + * g++.dg/gomp/pr60682.C: New test. + 2014-03-27 John David Anglin * gcc.dg/torture/pr60092.c: Remove default dg-skip-if arguments. diff --git a/gcc/testsuite/g++.dg/gomp/pr60682.C b/gcc/testsuite/g++.dg/gomp/pr60682.C new file mode 100644 index 0000000000000..fdd7a204c7705 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr60682.C @@ -0,0 +1,44 @@ +// PR middle-end/60682 +// { dg-do compile } +// { dg-options "-O2 -fopenmp-simd" } + +struct A +{ + float a; + A () {} + A (const A &x) { a = x.a; } +}; + +struct B +{ + A a[16]; +}; + +struct C +{ + float a[1]; + C () {} + C (const C &x) { a[0] = x.a[0]; } +}; + +struct D +{ + C a[16]; +}; + +void +foo (int x, B &y, D &z) +{ +#pragma omp simd + for (int i = 0; i < x; ++i) + { + A a; + y.a[i] = a; + } +#pragma omp simd + for (int i = 0; i < x; ++i) + { + C a; + z.a[i] = a; + } +}