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]

Re: [lno] make scev more careful on types


Are you aware of the bad interaction between -ftree-loop-optimize and the
monev analyzer? For example, there's a loop in SPECs bzip2 (bzip2.c line
2382, in function randomiseBlock()) which is being vectorized unless the
flag -ftree-loop-optimize is used:

Without -ftree-loop-optimize the loop looks as follows:

   <bb 0>:
     # i_59 = PHI <0(0), i_3(11)>;
   <L0>:;
     inUse[i_59] = 0;
     i_3 = i_59 + 1;
     if (i_3 <= 255) goto <L20>; else goto <L11>;
   <L20>:;
     goto <bb 1> (<L0>);

and the monev analyzer is able to determine the loop bound:

   <<<<<<< analyze_loop_nest >>>>>>>

   <<vect_analyze_loop_form>>

   <<get_loop_niters>>
   (number_of_iterations_in_loop
   (get_loop_exit_condition
     if (i_3 <= 255) goto <L20>; else goto <L11>;)
   (analyze_scalar_evolution
     (...)
     (...)
     (set_nb_iterations_in_loop = 256))
   get_loop_niters: 256.

However, with -ftree-loop-optimize, this is how the loop looks like:

   <bb 0>:
     # ivtmp.1357_99 = PHI <256(0), ivtmp.1357_100(11)>;
     # i_59 = PHI <0(0), i_3(11)>;
   <L0>:;
     inUse[i_59] = 0;
     i_3 = i_59 + 1;
     ivtmp.1357_100 = ivtmp.1357_99 + -1;
     if (ivtmp.1357_100 != 0) goto <L20>; else goto <L11>;
   <L20>:;
     goto <bb 1> (<L0>);


As a result, monev can't determine the loop bound:

   <<<<<<< analyze_loop_nest >>>>>>>

   <<vect_analyze_loop_form>>

   <<get_loop_niters>>
   (get_loop_exit_condition
     if (ivtmp.1357_100 != 0) goto <L20>; else goto <L11>;)
   Can't determine num iters.
   loop_analyzer: bad loop form.


dorit



                                                                                                                                        
                      Sebastian Pop                                                                                                     
                      <sebastian.pop@cri        To:       gcc-patches@gcc.gnu.org                                                       
                      .ensmp.fr>                cc:                                                                                     
                      Sent by:                  Subject:  [lno] make scev more careful on types                                         
                      gcc-patches-owner@                                                                                                
                      gcc.gnu.org                                                                                                       
                                                                                                                                        
                                                                                                                                        
                      23/03/2004 21:54                                                                                                  
                                                                                                                                        




Hi,

This patch makes the scalar evolution to be more careful on the
underlying type system.  It is more conservative on the detection of
the number of iterations.  Still, I don't get the elim-check work
correctly.

Seb

 * tree-cfg.c (print_loop): Modify dump formatting.
 (debug_loop_ir): Renamed tree_debug_loops.
 (tree_debug_loop): New.
 * tree-chrec.c: Restructure for handling more carefully types.
 * tree-chre.h: Same.
 * tree-fold-const.h: Same.
 * tree-fold-const.c: Same.
 * tree-scalar-evolution.c: Same.
 * tree-scalar-evolution.h: Same.
 * tree-data-ref.c (dump_data_dependence_relation): Remove the
 dump of the base_name because it produces too many conflicts in
 the diffs of the testsuite.
 (compute_all_dependences): Use pointers to the dependence_relations
 varray.
 (int_cst_value, build_classic_dist_vector): New.
 (find_data_references): Use pointers to datarefs varray.
 (analyze_all_data_dependences): Compute the classic distances.
 * tree-data-ref.h: Declare functions.
 * tree-dg.c (dg_create_graph): Update the uses of the data-ref functions.
 * tree-flow.h (debug_loop_ir): Renamed to tree_debug_loops.
 (tree_debug_loop): Declare.




#### 62.diff.gz has been removed from this note on March 25, 2004 by Dorit
Naishlos



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