------- Comment #4 from nemokingdom at gmail dot com 2009-03-19 02:46 ------- (In reply to comment #3) > I will take care of this one. > I add test case for this situation.
Index: testsuite/gcc.dg/autopar/pr39500-1.c =================================================================== --- testsuite/gcc.dg/autopar/pr39500-1.c (revision 0) +++ testsuite/gcc.dg/autopar/pr39500-1.c (revision 0) @@ -0,0 +1,29 @@ +/* pr39500: autopar fails to parallel */ +/* origin: nemoking...@gmail.com(LiFeng)*/ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-final_cleanup" } */ + +void abort (void); + +int main(void) +{ + int i; + int x[100]; + + for (i = 0; i < 100; i++) + x[i] = x[i+100]; + + for (i = 0; i < 100; i++) + { + if (x[i] != x[i+100]) + abort (); + } + + return 0; +} + +/* Check that the first loop in parloop got parallelized. */ + +/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops" } } */ +/* { dg-final { cleanup-tree-dump "parloops" } } */ +/* { dg-final { cleanup-tree-dump "final_cleanup" } } */ Index: testsuite/gcc.dg/autopar/pr39500-2.c =================================================================== --- testsuite/gcc.dg/autopar/pr39500-2.c (revision 0) +++ testsuite/gcc.dg/autopar/pr39500-2.c (revision 0) @@ -0,0 +1,21 @@ +/* pr39500: autopar fails to parallel */ +/* origin: nemoking...@gmail.com(LiFeng)*/ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-final_cleanup" } */ + +int main(void) +{ + int i; + int x[100]; + + for (i = 0; i < 101; i++) + x[i] = x[i+100]; + + return 0; +} + +/* Check that the first loop in parloop got parallelized. */ + +/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 0 "parloops" } } */ +/* { dg-final { cleanup-tree-dump "parloops" } } */ +/* { dg-final { cleanup-tree-dump "final_cleanup" } } */ Index: tree-data-ref.c =================================================================== --- tree-data-ref.c (revision 144648) +++ tree-data-ref.c (working copy) @@ -2302,7 +2302,7 @@ /* If the overlap occurs outside of the bounds of the loop, there is no dependence. */ - if (x1 > niter || y1 > niter) + if (x1 >= niter || y1 >= niter) { *overlaps_a = conflict_fn_no_dependence (); *overlaps_b = conflict_fn_no_dependence (); -- nemokingdom at gmail dot com changed: What |Removed |Added ---------------------------------------------------------------------------- Component|middle-end |c http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39500