Fix for ifcvt pass ordering

Jan Hubicka jh@suse.cz
Sat Oct 26 15:25:00 GMT 2002


> Jan Hubicka <jh@suse.cz> writes:
> 
> > Hi,
> > Robert's patch to disable early ifcvt passes had unwanted effect of
> > disabling almost all ifcvt with -ftracer.  -ftracer usually duplicates
> > code to make ifcvt impossible so we must run at least one pass before.
> > I would like to see this in the mainline too, but technically it is not
> > regression, so I would be happy with BIB branch too.
> > 
> > Wed Oct 16 20:23:12 CEST 2002  Jan Hubicka  <jh@suse.cz>
> > 	* toplev.c (dump_file_index): Add DFI_ce3.
> > 	(dump_file_info): Likewise.
> > 	(rest_of_compilation): Run first ifcvt pass before tracer.
> 
> This also causes a bunch of regressions on Darwin; at least, it's all
> the following:
> 
> native gcc.sum gcc.c-torture/compile/20000802-1.c,
> native gcc.sum gcc.c-torture/compile/20020604-1.c,
> native gcc.sum gcc.c-torture/compile/900407-1.c,
> native gcc.sum gcc.c-torture/compile/920501-4.c,
> native gcc.sum gcc.c-torture/compile/921011-1.c,
> native gcc.sum gcc.c-torture/compile/921013-1.c,
> native gcc.sum gcc.c-torture/compile/921206-1.c,
> native gcc.sum gcc.c-torture/compile/930523-1.c,
> native gcc.sum gcc.c-torture/compile/980329-1.c,
> native gcc.sum gcc.c-torture/compile/980506-2.c,
> native gcc.sum gcc.c-torture/execute/20000412-4.c
> native gcc.sum gcc.c-torture/execute/20000503-1.c
> native gcc.sum gcc.c-torture/execute/20000511-1.c
> native gcc.sum gcc.c-torture/execute/20020406-1.c
> native gcc.sum gcc.c-torture/execute/20020716-1.c
> native gcc.sum gcc.c-torture/execute/930123-1.c
> native gcc.sum gcc.c-torture/execute/931012-1.c

Hi,
the problem has been uncovered latent bug - we didn't run reg-scan pass in all
ocasions when cse2 has been disabled but used the info in final pass by
enabling alias analysis.  I am just testing the attached patch that makes the
ifcvt1 pass to finish with reg_scan data valid and all the subsequent passes to
update it as needed.

I've verified it to test the testcase, bootstrap in progress.  OK if it passes?

I apologize for the breakage.  Since I didn't expected the patch to
change something I must've missed the failures somehow.

Honza
Sun Oct 27 00:20:08 CEST 2002  Jan Hubicka  <jh@suse.cz>
	* toplev.c (rest_of_compilation): Reorganize way reg_scan is called
	before final pass.
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/toplev.c,v
retrieving revision 1.684
diff -c -3 -p -r1.684 toplev.c
*** toplev.c	25 Oct 2002 23:46:06 -0000	1.684
--- toplev.c	26 Oct 2002 22:19:53 -0000
*************** rest_of_compilation (decl)
*** 2987,3003 ****
        close_dump_file (DFI_bp, print_rtl_with_bb, insns);
        timevar_pop (TV_BRANCH_PROB);
      }
!   if (flag_if_conversion)
      {
-       timevar_push (TV_IFCVT);
-       if (rtl_dump_file)
- 	dump_flow_info (rtl_dump_file);
        open_dump_file (DFI_ce1, decl);
        cleanup_cfg (CLEANUP_EXPENSIVE);
        reg_scan (insns, max_reg_num (), 0);
!       if_convert (0);
        close_dump_file (DFI_ce1, print_rtl_with_bb, get_insns ());
-       timevar_pop (TV_IFCVT);
      }
    if (flag_tracer)
      {
--- 2987,3010 ----
        close_dump_file (DFI_bp, print_rtl_with_bb, insns);
        timevar_pop (TV_BRANCH_PROB);
      }
!   if (optimize >= 0)
      {
        open_dump_file (DFI_ce1, decl);
+       if (flag_if_conversion)
+ 	{
+ 	  timevar_push (TV_IFCVT);
+ 	  if (rtl_dump_file)
+ 	    dump_flow_info (rtl_dump_file);
+ 	  cleanup_cfg (CLEANUP_EXPENSIVE);
+ 	  reg_scan (insns, max_reg_num (), 0);
+ 	  if_convert (0);
+ 	  timevar_pop (TV_IFCVT);
+ 	}
+       timevar_push (TV_JUMP);
        cleanup_cfg (CLEANUP_EXPENSIVE);
        reg_scan (insns, max_reg_num (), 0);
!       timevar_pop (TV_JUMP);
        close_dump_file (DFI_ce1, print_rtl_with_bb, get_insns ());
      }
    if (flag_tracer)
      {
*************** rest_of_compilation (decl)
*** 3005,3051 ****
        open_dump_file (DFI_tracer, decl);
        if (rtl_dump_file)
  	dump_flow_info (rtl_dump_file);
-       cleanup_cfg (CLEANUP_EXPENSIVE);
        tracer ();
        cleanup_cfg (CLEANUP_EXPENSIVE);
        close_dump_file (DFI_tracer, print_rtl_with_bb, get_insns ());
        timevar_pop (TV_TRACER);
-       reg_scan (get_insns (), max_reg_num (), 0);
      }
  
!   if (optimize > 0)
      {
        timevar_push (TV_CSE2);
        open_dump_file (DFI_cse2, decl);
        if (rtl_dump_file)
  	dump_flow_info (rtl_dump_file);
  
!       if (flag_rerun_cse_after_loop)
  	{
  	  timevar_push (TV_JUMP);
! 	  reg_scan (insns, max_reg_num (), 0);
! 	  timevar_pop (TV_JUMP);
! 
  	  cleanup_cfg (CLEANUP_EXPENSIVE);
! 	  /* CFG is no longer maintained up-to-date.  */
! 	  reg_scan (insns, max_reg_num (), 0);
! 	  tem = cse_main (insns, max_reg_num (), 1, rtl_dump_file);
! 	  purge_all_dead_edges (0);
! 	  delete_trivially_dead_insns (insns, max_reg_num ());
! 
! 	  if (tem)
! 	    {
! 	      timevar_push (TV_JUMP);
! 	      rebuild_jump_labels (insns);
! 	      cleanup_cfg (CLEANUP_EXPENSIVE);
! 	      timevar_pop (TV_JUMP);
! 	    }
  	}
! 
        close_dump_file (DFI_cse2, print_rtl_with_bb, insns);
-       timevar_pop (TV_CSE2);
- 
        ggc_collect ();
      }
  
    cse_not_expected = 1;
--- 3012,3046 ----
        open_dump_file (DFI_tracer, decl);
        if (rtl_dump_file)
  	dump_flow_info (rtl_dump_file);
        tracer ();
        cleanup_cfg (CLEANUP_EXPENSIVE);
+       reg_scan (insns, max_reg_num (), 0);
        close_dump_file (DFI_tracer, print_rtl_with_bb, get_insns ());
        timevar_pop (TV_TRACER);
      }
  
!   if (flag_rerun_cse_after_loop)
      {
        timevar_push (TV_CSE2);
        open_dump_file (DFI_cse2, decl);
        if (rtl_dump_file)
  	dump_flow_info (rtl_dump_file);
+       /* CFG is no longer maintained up-to-date.  */
+       tem = cse_main (insns, max_reg_num (), 1, rtl_dump_file);
+       purge_all_dead_edges (0);
+       delete_trivially_dead_insns (insns, max_reg_num ());
  
!       if (tem)
  	{
  	  timevar_push (TV_JUMP);
! 	  rebuild_jump_labels (insns);
  	  cleanup_cfg (CLEANUP_EXPENSIVE);
! 	  timevar_pop (TV_JUMP);
  	}
!       reg_scan (insns, max_reg_num (), 0);
        close_dump_file (DFI_cse2, print_rtl_with_bb, insns);
        ggc_collect ();
+       timevar_pop (TV_CSE2);
      }
  
    cse_not_expected = 1;



More information about the Gcc-regression mailing list