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]

More rest_of_compilation cleanups



Hi,
this patch contains few more tweaks to rest_of_compilation. Mainlny it adds
delete_trivially_dead insns after cse and gcse as these always introduce many
dead insns and thus we should kill them early.

Bootstrapped/regtested i386

Honza

Sun Mar  3 19:18:59 CET 2002  Jan Hubicka  <jh@suse.cz>
	* toplev.c (rest_of_compilation): Do jump threading before SSA path;
	consistently call delete_trivially_dead_insns after CSE and GCSE;
	fix DFI_life dumping; do jump threading after liveness; do crossjumping
	after liveness2; update comment in last crossjumping.
	
*** toplev.c.old	Sun Mar  3 15:43:03 2002
--- toplev.c	Sun Mar  3 18:12:17 2002
*************** rest_of_compilation (decl)
*** 2612,2618 ****
    find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
    if (rtl_dump_file)
      dump_flow_info (rtl_dump_file);
!   cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0) | CLEANUP_PRE_LOOP);
  
    /* CFG is no longer maintained up-to-date.  */
    free_bb_for_insn ();
--- 2612,2619 ----
    find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
    if (rtl_dump_file)
      dump_flow_info (rtl_dump_file);
!   cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0) | CLEANUP_PRE_LOOP
! 	       | (flag_thread_jumps ? CLEANUP_THREADING : 0));
  
    /* CFG is no longer maintained up-to-date.  */
    free_bb_for_insn ();
*************** rest_of_compilation (decl)
*** 2705,2712 ****
        find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
        if (rtl_dump_file)
  	dump_flow_info (rtl_dump_file);
!       cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP
!  		   | (flag_thread_jumps ? CLEANUP_THREADING : 0));
  
        /* Try to identify useless null pointer tests and delete them.  */
        if (flag_delete_null_pointer_checks)
--- 2706,2712 ----
        find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
        if (rtl_dump_file)
  	dump_flow_info (rtl_dump_file);
!       cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
  
        /* Try to identify useless null pointer tests and delete them.  */
        if (flag_delete_null_pointer_checks)
*************** rest_of_compilation (decl)
*** 2752,2757 ****
--- 2752,2759 ----
  	rebuild_jump_labels (insns);
        purge_all_dead_edges (0);
  
+       delete_trivially_dead_insns (insns, max_reg_num ());
+ 
        /* If we are not running more CSE passes, then we are no longer
  	 expecting CSE to be run.  But always rerun it in a cheap mode.  */
        cse_not_expected = !flag_rerun_cse_after_loop && !flag_gcse;
*************** rest_of_compilation (decl)
*** 2759,2776 ****
        if (tem || optimize > 1)
  	cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
  
-       /* Run this after jump optmizations remove all the unreachable code
- 	 so that unreachable code will not keep values live.  */
-       delete_trivially_dead_insns (insns, max_reg_num (), 1);
- 
        /* Try to identify useless null pointer tests and delete them.  */
        if (flag_delete_null_pointer_checks || flag_thread_jumps)
  	{
  	  timevar_push (TV_JUMP);
  
- 	  cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP
- 		       | (flag_thread_jumps ? CLEANUP_THREADING : 0));
- 
  	  if (flag_delete_null_pointer_checks)
  	    delete_null_pointer_checks (insns);
  	  /* CFG is no longer maintained up-to-date.  */
--- 2761,2771 ----
*************** rest_of_compilation (decl)
*** 2810,2815 ****
--- 2805,2811 ----
        cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
        tem = gcse_main (insns, rtl_dump_file);
        rebuild_jump_labels (insns);
+       delete_trivially_dead_insns (insns, max_reg_num ());
  
        save_csb = flag_cse_skip_blocks;
        save_cfj = flag_cse_follow_jumps;
*************** rest_of_compilation (decl)
*** 2823,2828 ****
--- 2819,2825 ----
  	  reg_scan (insns, max_reg_num (), 1);
  	  tem2 = cse_main (insns, max_reg_num (), 0, rtl_dump_file);
  	  purge_all_dead_edges (0);
+ 	  delete_trivially_dead_insns (insns, max_reg_num ());
  	  timevar_pop (TV_CSE);
  	  cse_not_expected = !flag_rerun_cse_after_loop;
  	}
*************** rest_of_compilation (decl)
*** 2834,2840 ****
  	  tem = tem2 = 0;
  	  timevar_push (TV_JUMP);
  	  rebuild_jump_labels (insns);
- 	  delete_trivially_dead_insns (insns, max_reg_num (), 1);
  	  cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
  	  timevar_pop (TV_JUMP);
  
--- 2831,2836 ----
*************** rest_of_compilation (decl)
*** 2844,2849 ****
--- 2840,2846 ----
  	      reg_scan (insns, max_reg_num (), 1);
  	      tem2 = cse_main (insns, max_reg_num (), 0, rtl_dump_file);
  	      purge_all_dead_edges (0);
+ 	      delete_trivially_dead_insns (insns, max_reg_num ());
  	      timevar_pop (TV_CSE);
  	    }
  	}
*************** rest_of_compilation (decl)
*** 2881,2887 ****
  	     trivially dead.  We delete those instructions now in the
  	     hope that doing so will make the heuristics in loop work
  	     better and possibly speed up compilation.  */
! 	  delete_trivially_dead_insns (insns, max_reg_num (), 0);
  
  	  /* The regscan pass is currently necessary as the alias
  		  analysis code depends on this information.  */
--- 2878,2884 ----
  	     trivially dead.  We delete those instructions now in the
  	     hope that doing so will make the heuristics in loop work
  	     better and possibly speed up compilation.  */
! 	  delete_trivially_dead_insns (insns, max_reg_num ());
  
  	  /* The regscan pass is currently necessary as the alias
  		  analysis code depends on this information.  */
*************** rest_of_compilation (decl)
*** 2893,2899 ****
  		     | (flag_prefetch_loop_arrays ? LOOP_PREFETCH : 0));
  
        /* Loop can create trivially dead instructions.  */
!       delete_trivially_dead_insns (insns, max_reg_num (), 0);
        close_dump_file (DFI_loop, print_rtl, insns);
        timevar_pop (TV_LOOP);
  
--- 2890,2896 ----
  		     | (flag_prefetch_loop_arrays ? LOOP_PREFETCH : 0));
  
        /* Loop can create trivially dead instructions.  */
!       delete_trivially_dead_insns (insns, max_reg_num ());
        close_dump_file (DFI_loop, print_rtl, insns);
        timevar_pop (TV_LOOP);
  
*************** rest_of_compilation (decl)
*** 2982,2987 ****
--- 2979,2985 ----
  	      timevar_pop (TV_JUMP);
  	    }
  	}
+       delete_trivially_dead_insns (insns, max_reg_num ());
  
        close_dump_file (DFI_cse2, print_rtl_with_bb, insns);
        timevar_pop (TV_CSE2);
*************** rest_of_compilation (decl)
*** 2991,2997 ****
  
    cse_not_expected = 1;
  
!   close_dump_file (DFI_life, print_rtl_with_bb, insns);
    regclass_init ();
  
    check_function_return_warnings ();
--- 2989,2995 ----
  
    cse_not_expected = 1;
  
!   open_dump_file (DFI_life, decl);
    regclass_init ();
  
    check_function_return_warnings ();
*************** rest_of_compilation (decl)
*** 3001,3007 ****
  #endif
    life_analysis (insns, rtl_dump_file, PROP_FINAL);
    if (optimize)
!     cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE);
    timevar_pop (TV_FLOW);
  
    no_new_pseudos = 1;
--- 2999,3006 ----
  #endif
    life_analysis (insns, rtl_dump_file, PROP_FINAL);
    if (optimize)
!     cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE
! 		 | (flag_thread_jumps ? CLEANUP_THREADING : 0));
    timevar_pop (TV_FLOW);
  
    no_new_pseudos = 1;
*************** rest_of_compilation (decl)
*** 3258,3265 ****
  
    if (optimize)
      {
-       cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_CROSSJUMP);
        life_analysis (insns, rtl_dump_file, PROP_FINAL);
  
        /* This is kind of a heuristic.  We need to run combine_stack_adjustments
           even for machines with possibly nonzero RETURN_POPS_ARGS
--- 3257,3264 ----
  
    if (optimize)
      {
        life_analysis (insns, rtl_dump_file, PROP_FINAL);
+       cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_CROSSJUMP | CLEANUP_UPDATE_LIFE);
  
        /* This is kind of a heuristic.  We need to run combine_stack_adjustments
           even for machines with possibly nonzero RETURN_POPS_ARGS
*************** rest_of_compilation (decl)
*** 3361,3368 ****
        timevar_push (TV_REORDER_BLOCKS);
        open_dump_file (DFI_bbro, decl);
  
!       /* Last attempt to optimize CFG, as life analyzis possibly removed
! 	 some instructions.  */
        cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK
  		   | CLEANUP_CROSSJUMP);
        if (flag_reorder_blocks)
--- 3360,3368 ----
        timevar_push (TV_REORDER_BLOCKS);
        open_dump_file (DFI_bbro, decl);
  
!       /* Last attempt to optimize CFG, as scheduling, peepholing
! 	 and insn splitting possibly introduced more crossjumping
! 	 oppurtuntities.  */
        cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK
  		   | CLEANUP_CROSSJUMP);
        if (flag_reorder_blocks)


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