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]

[rtlopt, hammer] Fix loop preheader code


Hi,
this patch fixes crash when compiling gcc with unrolling.  Unfortunately
another crash is still present :(

Zdenek, please when you do similar tricks on top of cfg_layout
datastructures, create new function for that in cfglayout.c so all the
hacks remains at same pleace.

Honza

Sat Dec  7 15:11:35 CET 2002  Jan Hubicka  <jh@suse.cz>
	* cfglayout.c (cfg_layout_split_block): New function.
	* cfglayout.h (cfg_layout_split_block): Declare.
	* cfgloopmanip.c (create_preheader): Use it.

Index: cfglayout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfglayout.c,v
retrieving revision 1.22.6.1
diff -c -3 -p -r1.22.6.1 cfglayout.c
*** cfglayout.c	2 Dec 2002 23:45:36 -0000	1.22.6.1
--- cfglayout.c	7 Dec 2002 14:10:47 -0000
*************** cfg_layout_redirect_edge (e, dest)
*** 889,894 ****
--- 889,908 ----
    return ret;
  }
  
+ /* Same as split_block but update cfg_layout structures.  */
+ edge
+ cfg_layout_split_block (bb, insn)
+      basic_block bb;
+      rtx insn;
+ {
+   edge fallthru = split_block (bb, insn);
+ 
+   alloc_aux_for_block (fallthru->dest, sizeof (struct reorder_block_def));
+   RBI (fallthru->dest)->footer = RBI (fallthru->src)->footer;
+   RBI (fallthru->src)->footer = NULL;
+   return fallthru;
+ }
+ 
  /* Create an duplicate of the basic block BB and redirect edge E into it.  */
  
  basic_block
Index: cfglayout.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfglayout.h,v
retrieving revision 1.3.20.1
diff -c -3 -p -r1.3.20.1 cfglayout.h
*** cfglayout.h	2 Dec 2002 23:45:36 -0000	1.3.20.1
--- cfglayout.h	7 Dec 2002 14:10:47 -0000
*************** extern basic_block cfg_layout_duplicate_
*** 42,44 ****
--- 42,45 ----
  extern void scope_to_insns_initialize	PARAMS ((void));
  extern void scope_to_insns_finalize	PARAMS ((void));
  extern bool cfg_layout_redirect_edge	PARAMS ((edge, basic_block));
+ extern edge cfg_layout_split_block	PARAMS ((basic_block, rtx));
Index: cfgloopmanip.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/cfgloopmanip.c,v
retrieving revision 1.1.4.1
diff -c -3 -p -r1.1.4.1 cfgloopmanip.c
*** cfgloopmanip.c	4 Dec 2002 01:03:33 -0000	1.1.4.1
--- cfgloopmanip.c	7 Dec 2002 14:10:47 -0000
*************** create_preheader (loop, dom, flags)
*** 1191,1197 ****
        /* Split_block would not split block after its end.  */
        emit_note_after (NOTE_INSN_DELETED, insn);
      }
!   fallthru = split_block (loop->header, insn);
    dummy = fallthru->src;
    loop->header = fallthru->dest;
  
--- 1191,1200 ----
        /* Split_block would not split block after its end.  */
        emit_note_after (NOTE_INSN_DELETED, insn);
      }
!   if (flags & CP_INSIDE_CFGLAYOUT)
!     fallthru = cfg_layout_split_block (loop->header, insn);
!   else
!     fallthru = split_block (loop->header, insn);
    dummy = fallthru->src;
    loop->header = fallthru->dest;
  
*************** create_preheader (loop, dom, flags)
*** 1201,1208 ****
      if (ploop->latch == dummy)
        ploop->latch = fallthru->dest;
  
-   if (flags & CP_INSIDE_CFGLAYOUT)
-     alloc_aux_for_block (fallthru->dest, sizeof (struct reorder_block_def));
    add_to_dominance_info (dom, fallthru->dest);
    
    /* Redirect edges. */
--- 1204,1209 ----


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