Commit 31432e21 by Richard Guenther Committed by Richard Biener

re PR tree-optimization/46886 (wrong code with -ftree-parallelize-loops -fno-tree-ch)

2012-03-08  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/46886
	* tree-flow.h (do_while_loop_p): Declare.
	* tree-ssa-loop-ch.c (do_while_loop_p): Export.
	* tree-parloops.c (parallelize_loops): Only parallelize do-while
	loops.

	* testsuite/libgomp.c/pr46886.c: New testcase.

From-SVN: r184010
parent c51ec0a3
2012-02-08 Richard Guenther <rguenther@suse.de>
PR tree-optimization/46886
* tree-flow.h (do_while_loop_p): Declare.
* tree-ssa-loop-ch.c (do_while_loop_p): Export.
* tree-parloops.c (parallelize_loops): Only parallelize do-while
loops.
2012-02-08 Andrew MacLeod <amacleod@redhat.com> 2012-02-08 Andrew MacLeod <amacleod@redhat.com>
* optabs.c (expand_atomic_load): Do not assume compare_and_swap will * optabs.c (expand_atomic_load): Do not assume compare_and_swap will
......
...@@ -619,6 +619,9 @@ extern bool may_propagate_copy (tree, tree); ...@@ -619,6 +619,9 @@ extern bool may_propagate_copy (tree, tree);
extern bool may_propagate_copy_into_stmt (gimple, tree); extern bool may_propagate_copy_into_stmt (gimple, tree);
extern bool may_propagate_copy_into_asm (tree); extern bool may_propagate_copy_into_asm (tree);
/* In tree-ssa-loop-ch.c */
bool do_while_loop_p (struct loop *);
/* Affine iv. */ /* Affine iv. */
typedef struct typedef struct
......
...@@ -2183,7 +2183,10 @@ parallelize_loops (void) ...@@ -2183,7 +2183,10 @@ parallelize_loops (void)
|| loop_has_blocks_with_irreducible_flag (loop) || loop_has_blocks_with_irreducible_flag (loop)
|| (loop_preheader_edge (loop)->src->flags & BB_IRREDUCIBLE_LOOP) || (loop_preheader_edge (loop)->src->flags & BB_IRREDUCIBLE_LOOP)
/* FIXME: the check for vector phi nodes could be removed. */ /* FIXME: the check for vector phi nodes could be removed. */
|| loop_has_vector_phi_nodes (loop)) || loop_has_vector_phi_nodes (loop)
/* FIXME: transform_to_exit_first_loop does not handle not
header-copied loops correctly - see PR46886. */
|| !do_while_loop_p (loop))
continue; continue;
estimated = max_stmt_executions_int (loop, false); estimated = max_stmt_executions_int (loop, false);
/* FIXME: Bypass this check as graphite doesn't update the /* FIXME: Bypass this check as graphite doesn't update the
......
...@@ -104,7 +104,7 @@ should_duplicate_loop_header_p (basic_block header, struct loop *loop, ...@@ -104,7 +104,7 @@ should_duplicate_loop_header_p (basic_block header, struct loop *loop,
/* Checks whether LOOP is a do-while style loop. */ /* Checks whether LOOP is a do-while style loop. */
static bool bool
do_while_loop_p (struct loop *loop) do_while_loop_p (struct loop *loop)
{ {
gimple stmt = last_stmt (loop->latch); gimple stmt = last_stmt (loop->latch);
......
2012-02-08 Richard Guenther <rguenther@suse.de>
PR tree-optimization/46886
* testsuite/libgomp.c/pr46886.c: New testcase.
2012-01-25 Matthias Klose <doko@ubuntu.com> 2012-01-25 Matthias Klose <doko@ubuntu.com>
* config/linux/arm: Remove empty directory. * config/linux/arm: Remove empty directory.
......
/* { dg-do run } */
/* { dg-options "-O -ftree-parallelize-loops=4 -fno-tree-ch -fno-tree-dominator-opts" } */
void abort(void);
int d[1024], e[1024];
int foo (void)
{
int s = 0;
int i;
for (i = 0; i < 1024; i++)
s += d[i] - e[i];
return s;
}
int main ()
{
int i;
for (i = 0; i < 1024; i++)
{
d[i] = i * 2;
e[i] = i;
}
if (foo () != 1023 * 1024 / 2)
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