mirror of git://gcc.gnu.org/git/gcc.git
Optimize expand_omp_for_static_chunk for chunk_size one
2015-08-24 Tom de Vries <tom@codesourcery.com> PR tree-optimization/65468 * omp-low.c (expand_omp_for_static_chunk): Remove inner loop if chunk_size is one. * gcc.dg/gomp/static-chunk-size-one.c: New test. * testsuite/libgomp.c/static-chunk-size-one.c: New test. From-SVN: r227124
This commit is contained in:
parent
7373d132e1
commit
6be5c241bb
|
|
@ -1,3 +1,9 @@
|
|||
2015-08-24 Tom de Vries <tom@codesourcery.com>
|
||||
|
||||
PR tree-optimization/65468
|
||||
* omp-low.c (expand_omp_for_static_chunk): Remove inner loop if
|
||||
chunk_size is one.
|
||||
|
||||
2015-08-24 Nathan Sidwell <nathan@acm.org>
|
||||
|
||||
* config/nvptx/nvptx.c (walk_args_for_param): Revert previous
|
||||
|
|
|
|||
|
|
@ -7204,9 +7204,14 @@ expand_omp_for_static_chunk (struct omp_region *region,
|
|||
assign_stmt = gimple_build_assign (vback, t);
|
||||
gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT);
|
||||
|
||||
t = build2 (fd->loop.cond_code, boolean_type_node,
|
||||
DECL_P (vback) && TREE_ADDRESSABLE (vback)
|
||||
? t : vback, e);
|
||||
if (tree_int_cst_equal (fd->chunk_size, integer_one_node))
|
||||
t = build2 (EQ_EXPR, boolean_type_node,
|
||||
build_int_cst (itype, 0),
|
||||
build_int_cst (itype, 1));
|
||||
else
|
||||
t = build2 (fd->loop.cond_code, boolean_type_node,
|
||||
DECL_P (vback) && TREE_ADDRESSABLE (vback)
|
||||
? t : vback, e);
|
||||
gsi_insert_before (&gsi, gimple_build_cond_empty (t), GSI_SAME_STMT);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
2015-08-24 Tom de Vries <tom@codesourcery.com>
|
||||
|
||||
PR tree-optimization/65468
|
||||
* gcc.dg/gomp/static-chunk-size-one.c: New test.
|
||||
|
||||
2015-08-23 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
|
||||
|
||||
PR libfortran/54572
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-fopenmp -O2 -fdump-tree-optimized -fno-tree-pre" } */
|
||||
|
||||
int
|
||||
bar ()
|
||||
{
|
||||
int a = 0, i;
|
||||
|
||||
#pragma omp parallel for num_threads (3) reduction (+:a) schedule(static, 1)
|
||||
for (i = 0; i < 10; i++)
|
||||
a += i;
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
/* Two phis for reduction, one in loop header, one in loop exit. One phi for iv
|
||||
in loop header. */
|
||||
/* { dg-final { scan-tree-dump-times "PHI" 3 "optimized" } } */
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
2015-08-24 Tom de Vries <tom@codesourcery.com>
|
||||
|
||||
PR tree-optimization/65468
|
||||
* testsuite/libgomp.c/static-chunk-size-one.c: New test.
|
||||
|
||||
2015-08-24 Joost VandeVondele <vondele@gnu.gcc.org>
|
||||
|
||||
PR libgomp/66761
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
extern void abort ();
|
||||
|
||||
int
|
||||
bar ()
|
||||
{
|
||||
int a = 0, i;
|
||||
|
||||
#pragma omp parallel for num_threads (3) reduction (+:a) schedule(static, 1)
|
||||
for (i = 0; i < 10; i++)
|
||||
a += i;
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
int res;
|
||||
res = bar ();
|
||||
if (res != 45)
|
||||
abort ();
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in New Issue