Skip to content

Commit

Permalink
PR middle-end/60682
Browse files Browse the repository at this point in the history
	* 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.

	* g++.dg/gomp/pr60682.C: New test.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208864 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
jakub committed Mar 27, 2014
1 parent 780b9a2 commit ef8cfd4
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 1 deletion.
7 changes: 7 additions & 0 deletions gcc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2014-03-27 Jakub Jelinek <[email protected]>

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 <[email protected]>

PR target/60580
Expand Down
15 changes: 14 additions & 1 deletion gcc/omp-low.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
5 changes: 5 additions & 0 deletions gcc/testsuite/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2014-03-27 Jakub Jelinek <[email protected]>

PR middle-end/60682
* g++.dg/gomp/pr60682.C: New test.

2014-03-27 John David Anglin <[email protected]>

* gcc.dg/torture/pr60092.c: Remove default dg-skip-if arguments.
Expand Down
44 changes: 44 additions & 0 deletions gcc/testsuite/g++.dg/gomp/pr60682.C
Original file line number Diff line number Diff line change
@@ -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;
}
}

0 comments on commit ef8cfd4

Please sign in to comment.