This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Warning when compiling dwarf2out.c with -ftree-parallelize-loops=4
- From: Zdenek Dvorak <rakdver at kam dot mff dot cuni dot cz>
- To: Razya Ladelsky <RAZYA at il dot ibm dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 25 Nov 2008 19:29:59 +0100
- Subject: Re: Warning when compiling dwarf2out.c with -ftree-parallelize-loops=4
- References: <OF1A4D4B46.CD2489CC-ONC225750A.0057A835-C225750C.0052FA00@il.ibm.com>
Hi,
> As far as I get it, there is no real failure here.
> Parloop, unaware of the array's upper bound, inserts the 'enough
> iterations' condition (i>400-1), and thereby
> makes the last iteration range from 400 upwards.
> VRP now has a constant it can compare to the array's upper bound.
> Correct programs that do not exceed the array bound will now fail because
> VRP is not aware of the
> fact that the parallel code (and last iteration it is looking at) is
> actually not executed in these cases.
>
> I'm not sure how to proceed, in order to avoid this warning.
> Any ideas?
I would propose changing the test
expected_loop_iterations (loop) <= n_threads
in tree-parloops.c to
((nit = estimated_loop_iterations_int (loop, false)) >= 0
&& nit < MIN_PER_THREAD * n_threads)
Which should prevent the parallelization for this loop, as we should be
able to derive that the loop iterates at most 4 times due to the array
access.
Zdenek