This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR 38275, bootstrap failure with autopar enabled


Hi,

This patch fixes the failure in bootstrap when autopar is enabled.
It failed due to "array subscript is above array" warning(treated as 
error)
at VRP pass. 
The case is of an array of size 4 which is accessed in a loop
that gets parallelized during autopar. 
The parallelization pass inserts this guard, 
if (niters > number_of_threads * MIN_PER_THREAD), 
where the right-hand side gets the value 400 at compile time.
VRP pass then detects that the last iteration accesses the array at 
index>400,
and yields the warning.
The solution (suggested by Zdenek) is to replace the compile-time 
profitability test
expected_loop_iterations (loop) <= n_threads
with
estimated_loop_iterations_int (loop, false) <= n_threads * MIN_PER_THREAD.

This check makes more sense for two reasons:
1. estimated_loop_iterations_int considers the ranges of the arrays 
accessed in the loop.
2. We make the compile time check compatible with the runtime check, which 
uses 
a threshold bigger than just number of threads.
 

Finally bootstrap with autopar enabled passes bootstrap on power6 linux
(tested for all languages except ada and java)
The patch introduces no new testsuite regressions.

The autopar suite needed some adjustments, as the testcases often had
too little iterations.

Ok for trunk?
Thanks,
Razya

2009-08-25  Razya Ladelsky  <razya@il.ibm.com>

      PR tree-optimization/38275
      * tree-parloops.c (parallelize_loops): Replace profitability 
condition
         for expected number of iterations.

2009-08-25  Alon Dayan  <alond@il.ibm.com>

      PR tree-optimization/38275
      * testsuite/gcc.dg/autopar/reduc-1char.c: Increase number of 
iterations. 
         Adjust the logic accordingly.
         * testsuite/gcc.dg/autopar/reduc-2char.c: Ditto.
         * testsuite/gcc.dg/autopar/reduc-1.c: Ditto.
         * testsuite/gcc.dg/autopar/reduc-2.c: Ditto.
         * testsuite/gcc.dg/autopar/reduc-3.c: Ditto.
         * testsuite/gcc.dg/autopar/reduc-6.c: Ditto.
         * testsuite/gcc.dg/autopar/reduc-7.c: Ditto.
         * testsuite/gcc.dg/autopar/reduc-8.c: Ditto.
         * testsuite/gcc.dg/autopar/reduc-9.c: Ditto.
         * testsuite/gcc.dg/autopar/pr39500-1.c: Ditto.
         * testsuite/gcc.dg/autopar/reduc-1short.c: Ditto.
         * testsuite/gcc.dg/autopar/reduc-2short.c: Ditto.
         * testsuite/gcc.dg/autopar/parallelization-1.c: Ditto.


Attachment: boots_fix.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]