diff options
author | Tom de Vries <tom@codesourcery.com> | 2015-08-24 13:14:17 +0000 |
---|---|---|
committer | Tom de Vries <vries@gcc.gnu.org> | 2015-08-24 13:14:17 +0000 |
commit | 6be5c241bbf8f3b6cec45f0b1074156822a96359 (patch) | |
tree | e8ba4654c7ecc7f4b815ad5cbf25b654f1dd4526 /gcc/omp-low.c | |
parent | 7373d132e1f364cb3ee2a045b6319a866f1e7d86 (diff) | |
download | gcc-6be5c241bbf8f3b6cec45f0b1074156822a96359.zip gcc-6be5c241bbf8f3b6cec45f0b1074156822a96359.tar.gz gcc-6be5c241bbf8f3b6cec45f0b1074156822a96359.tar.bz2 |
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
Diffstat (limited to 'gcc/omp-low.c')
-rw-r--r-- | gcc/omp-low.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c index d181101..19f34ec 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -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); } |