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]

[tree-profiling/RFC] Avoid unreachable function removal after inlining


Hi,
removal of unreachable functions after inlining is confusing Zadeck's
alias analysis.  We've discussed this with Kenneth and Daniel and the
outcome is that for the moment we will give up the current ordering of
passes (where all local info is gathered first, IPA is performed then
and all changes done last) and do the more natural ordering where each
pass does it's own analysis, propagation and modification at it's will.

The passmanager is structured this way to allow possible future link
time IPA to do optimization decisions before reading function bodies
into memory and allow compilation without reading everything at once to
reduce peak memory usage.

I've looked on Open64 and partly at HP implementation and they both
implement kind of summary optimization and features avoiding functions
in memory so I would like to return to this idea later, but it seem to
make sense to first figure out what exactly we need in the summaries as
it is just more an baggage we need to carry on for the moment.

The Open64 implementation actually has function summaries more similar
to simplified representation of whole function body (they have full CFG,
dataflow and some operations exposed), so the IPA optimizers can be
tought of as operating directly on function bodies just in less verbose
IL format (not verbose enought to get full function semantics but
enought to do the simplistics analysis needed).  Perhaps this is easier
way to go (one needs to rewrite all analysis to new IL and write every
transformation twice for both ILs but has no ordering issues).
It is dificult to get precise infomration about HP optimizer.  Any more
info would be welcome.

It needs soome time to restructure current code to allow the other
ordering of passes (major offender is the inliner that don't know how to
apply inlining to all bodies at once).  I don't want to mess with it at
the very moment as inliner needs cleanups first, thus I made this simple
hack to allow Kenny to proceed.

I've commited the attache patch as obvious (testing is still in progress
but earlier version that just remove the dead function removal instead
of moving it after IPA did work)

Honza

2004-12-02  Jan Hubicka  <jh@suse.cz>
	Temporarily avoid unreachable node removal for IPA stuff.
	* cgraphunit.c (cgraph_optimize): Remove unreachable nodes.
	* ipa-inline.c (cgraph_decide_inlining): Do not remove unreachable
	nodes.
Index: cgraphunit.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cgraphunit.c,v
retrieving revision 1.1.4.35.2.31
diff -c -3 -p -r1.1.4.35.2.31 cgraphunit.c
*** cgraphunit.c	2 Dec 2004 15:32:17 -0000	1.1.4.35.2.31
--- cgraphunit.c	2 Dec 2004 15:47:59 -0000
*************** cgraph_optimize (void)
*** 1149,1154 ****
--- 1149,1157 ----
      }
  
    ipa_passes ();
+   /* FIXME: this should be unnecesary if inliner took care of removing dead
+      functions.  */
+   cgraph_remove_unreachable_nodes (false, dump_file);  
    cgraph_global_info_ready = true;
    if (cgraph_dump_file)
      {
Index: ipa-inline.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/ipa-inline.c,v
retrieving revision 1.1.2.2
diff -c -3 -p -r1.1.2.2 ipa-inline.c
*** ipa-inline.c	1 Dec 2004 00:03:05 -0000	1.1.2.2
--- ipa-inline.c	2 Dec 2004 15:48:00 -0000
*************** cgraph_decide_inlining (void)
*** 860,866 ****
    /* We will never output extern functions we didn't inline. 
       ??? Perhaps we can prevent accounting of growth of external
       inline functions.  */
!   cgraph_remove_unreachable_nodes (false, dump_file);
  
    if (dump_file)
      fprintf (dump_file,
--- 860,872 ----
    /* We will never output extern functions we didn't inline. 
       ??? Perhaps we can prevent accounting of growth of external
       inline functions.  */
! 
!   /* FIXME: at the moment we don't want to remove nodes here
!      or we confuse aliasing code.  This needs to be dealt with
!      better later by reorganizing the order of analysis.  
! 
!      Uncommenting this should make same call in cgraph_optimize unnecesary.
!   cgraph_remove_unreachable_nodes (false, dump_file);  */
  
    if (dump_file)
      fprintf (dump_file,


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