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]

pretty-ipa merge 1: cgraph_function_body_availability fix


Hi,
first I would like to merge some of minor infrastructure
improvements/cleanups from pretty-ipa so we reduce mainline-branch noise
factor.  This fixes cgraph_function_body_availability. As disucssed on 
IRC while back, in both C and C++ it is safe to assume that if function
was declared inline, it is not going to be overwritten linktime by
function with different semantics.

Bootstraped/regtested i686, will commit it later today if there are no
complains.

Honza

Index: ChangeLog
===================================================================
*** ChangeLog	(revision 145166)
--- ChangeLog	(working copy)
***************
*** 1,5 ****
--- 1,10 ----
  2009-03-28  Jan Hubicka  <jh@suse.cz>
  
+ 	* cgraph.c (cgraph_function_body_availability): Functions declared
+ 	inline are always safe to assume that it is not going to be replaced.
+ 
+ 2009-03-28  Jan Hubicka  <jh@suse.cz>
+ 
  	* tree-eh.c (inlinable_call_p): New function.
  	(make_eh_edges): Use it.
  	(verify_eh_edges): Use it.
Index: cgraph.c
===================================================================
*** cgraph.c	(revision 145165)
--- cgraph.c	(working copy)
*************** cgraph_function_body_availability (struc
*** 1429,1434 ****
--- 1429,1439 ----
      avail = AVAIL_LOCAL;
    else if (!node->local.externally_visible)
      avail = AVAIL_AVAILABLE;
+   /* Inline functions are safe to be analyzed even if their sybol can
+      be overwritten at runtime.  It is not meaningful to enfore any sane
+      behaviour on replacing inline function by different body.  */
+   else if (DECL_DECLARED_INLINE_P (node->decl))
+     avail = AVAIL_AVAILABLE;
  
    /* If the function can be overwritten, return OVERWRITABLE.  Take
       care at least of two notable extensions - the COMDAT functions
*************** cgraph_function_body_availability (struc
*** 1438,1452 ****
  
       ??? Does the C++ one definition rule allow us to always return
       AVAIL_AVAILABLE here?  That would be good reason to preserve this
!      hook Similarly deal with extern inline functions - this is again
!      necessary to get C++ shared functions having keyed templates
!      right and in the C extension documentation we probably should
!      document the requirement of both versions of function (extern
!      inline and offline) having same side effect characteristics as
!      good optimization is what this optimization is about.  */
  
!   else if (!(*targetm.binds_local_p) (node->decl)
! 	   && !DECL_COMDAT (node->decl) && !DECL_EXTERNAL (node->decl))
      avail = AVAIL_OVERWRITABLE;
    else avail = AVAIL_AVAILABLE;
  
--- 1443,1451 ----
  
       ??? Does the C++ one definition rule allow us to always return
       AVAIL_AVAILABLE here?  That would be good reason to preserve this
!      bit.  */
  
!   else if (DECL_REPLACEABLE_P (node->decl) && !DECL_EXTERNAL (node->decl))
      avail = AVAIL_OVERWRITABLE;
    else avail = AVAIL_AVAILABLE;
  


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