[PATCH] Do not cleanup_cfg when it is not necessary, and don't renumber_insns

Steven Bosscher stevenb.gcc@gmail.com
Tue Jan 23 16:51:00 GMT 2007


Hello,

This patch removes two cleanup_cfg calls that follow, well, cleanup_cfg
calls with nothing in between.  Does the word "redundant" ringahbell?

Further, I've removed the renumber_insns call from rest_of_handle_jump2
because it is not useful, and it also just so happens that renumber_insns
fails when we are in cfglayout mode.  You end up with duplicate INSN_UIDs
because renumber_insns doesn't look at the basic block headers/footers
which also need to be renumbered.

I decided to just don't renumber insns at all (instead of making it work
with the CFG) because I do not believe this call is still useful now
that tree-ssa already nukes most dead code.  I've measured compile times
for some really large functions (the flatten attribute actually has a
real use here ;-) and there was no noticable change in compile time or
peak memory usage.

Bootstrapped&tested on ia64-unknown-linux-gnu.  OK for trunk?

Gr.
Steven

	* tracer.c (rest_of_handle_tracer): We already cleaned
	up the CFG in tracer() so don't do it here again.
	* cfgcleanup.c (rest_of_handle_jump2): Don't repeat
	cleanup_cfg here, either.  And don't call renumber_insns.

Index: gcc/tracer.c
===================================================================
--- gcc/tracer.c	(revision 121061)
+++ gcc/tracer.c	(working copy)
@@ -393,7 +393,6 @@
   if (dump_file)
     dump_flow_info (dump_file, dump_flags);
   tracer (0);
-  cleanup_cfg (CLEANUP_EXPENSIVE);
   reg_scan (get_insns (), max_reg_num ());
   return 0;
 }
Index: gcc/cfgcleanup.c
===================================================================
--- gcc/cfgcleanup.c	(revision 121061)
+++ gcc/cfgcleanup.c	(working copy)
@@ -2318,16 +2318,6 @@
     dump_flow_info (dump_file, dump_flags);
   cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0)
 	       | (flag_thread_jumps ? CLEANUP_THREADING : 0));
-
-  if (optimize)
-    cleanup_cfg (CLEANUP_EXPENSIVE);
-
-  /* Jump optimization, and the removal of NULL pointer checks, may
-     have reduced the number of instructions substantially.  CSE, and
-     future passes, allocate arrays whose dimensions involve the
-     maximum instruction UID, so if we can reduce the maximum UID
-     we'll save big on memory.  */
-  renumber_insns ();
   return 0;
 }
 



More information about the Gcc-patches mailing list