Commit 6be5c241 by Tom de Vries Committed by Tom de Vries

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
parent 7373d132
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,6 +7204,11 @@ 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);
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);
......
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
......
/* { 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" } } */
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
......
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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment