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][RFC] Move IVOPTs right before expansion


This patch moves IVOPTs to right before expansion (well, nearly).
That allows to establish a lowering process there and also allows
the memory optimizers running after loop optimizations do something
reasonable again (they do not handle TARGET_MEM_REFs very well as
they break TBAA).

I have bootstrapped and tested the patch last year as well as ran
SPEC 2000 and SPEC 2006 on x86_64 with effects in the noise.

Any comments on why this is not a good idea?

Thanks,
Richard.

Index: gcc/passes.c
===================================================================
*** gcc/passes.c	(revision 156009)
--- gcc/passes.c	(working copy)
*************** init_optimization_passes (void)
*** 907,913 ****
  	  NEXT_PASS (pass_slp_vectorize);
  	  NEXT_PASS (pass_parallelize_loops);
  	  NEXT_PASS (pass_loop_prefetch);
- 	  NEXT_PASS (pass_iv_optimize);
  	  NEXT_PASS (pass_tree_loop_done);
  	}
        NEXT_PASS (pass_cse_reciprocals);
--- 907,912 ----
*************** init_optimization_passes (void)
*** 937,942 ****
--- 936,942 ----
        NEXT_PASS (pass_forwprop);
        NEXT_PASS (pass_phiopt);
        NEXT_PASS (pass_fold_builtins);
+       NEXT_PASS (pass_iv_optimize);
        NEXT_PASS (pass_tail_calls);
        NEXT_PASS (pass_rename_ssa_copies);
        NEXT_PASS (pass_uncprop);
Index: gcc/tree-ssa-loop.c
===================================================================
*** gcc/tree-ssa-loop.c	(revision 156009)
--- gcc/tree-ssa-loop.c	(working copy)
*************** struct gimple_opt_pass pass_loop_prefetc
*** 632,641 ****
  static unsigned int
  tree_ssa_loop_ivopts (void)
  {
    if (number_of_loops () <= 1)
!     return 0;
  
    tree_ssa_iv_optimize ();
    return 0;
  }
  
--- 632,654 ----
  static unsigned int
  tree_ssa_loop_ivopts (void)
  {
+   loop_optimizer_init (LOOPS_NORMAL
+ 		       | LOOPS_HAVE_RECORDED_EXITS);
    if (number_of_loops () <= 1)
!     {
!       loop_optimizer_finalize ();
!       return 0;
!     }
! 
!   rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
!   scev_initialize ();
  
    tree_ssa_iv_optimize ();
+ 
+   free_numbers_of_iterations_estimates ();
+   scev_finalize ();
+   loop_optimizer_finalize ();
+ 
    return 0;
  }
  
*************** struct gimple_opt_pass pass_iv_optimize
*** 660,666 ****
    0,					/* properties_provided */
    0,					/* properties_destroyed */
    0,					/* todo_flags_start */
!   TODO_dump_func | TODO_verify_loops
    | TODO_update_ssa | TODO_ggc_collect	/* todo_flags_finish */
   }
  };
--- 673,679 ----
    0,					/* properties_provided */
    0,					/* properties_destroyed */
    0,					/* todo_flags_start */
!   TODO_dump_func | TODO_cleanup_cfg
    | TODO_update_ssa | TODO_ggc_collect	/* todo_flags_finish */
   }
  };


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