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-ssa/mainline] PR 14756


Hi,
the error is quite right about the fact that called function is not
being considered for inlining.  The function is not inline function, but
in the macro call it is casted to inline function, so we get the warning
output.

This patch makes the errors/warnings to be controlled by the function
type, not the type it has been possibly casted to.

Zack, perhaps we should issue warning when casting non-inlie to inline
and error when casting non-always-inline to always-inline?

Bootstrapping/regtesting i686-pc-gnu-linux, OK?
The patch also fixes bug that causes cgraph dump files to be missing and
enables the dumps in non-unit-at-a-time (as they contain interesting
info too)

Honza

2004-03-28  Jan Hubicka  <jh@suse.cz>

	PR 14756
	* tree-inline.c (expand_call_inline):  Look for type of the function itself,
	not the type it has been casted to.
	* toplev.c (backend_init): Add missing call to inint_optimization_passes.
	* passes.c (init_optimization_passes, finish_optimization_passes): Output cgraph
	dump file in non-unit-at-a-time mode.

Index: tree-inline.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
retrieving revision 1.26.2.88
diff -c -3 -p -r1.26.2.88 tree-inline.c
*** tree-inline.c	26 Mar 2004 16:22:27 -0000	1.26.2.88
--- tree-inline.c	28 Mar 2004 17:00:31 -0000
*************** expand_call_inline (tree *tp, int *walk_
*** 1488,1500 ****
       inlining.  */
    if (!cgraph_inline_p (edge, &reason))
      {
!       if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)))
  	{
! 	  sorry ("%Jinlining failed in call to '%F': %s", fn, fn, reason);
  	  sorry ("called from here");
  	}
!       else if (warn_inline && DECL_DECLARED_INLINE_P (fn)
! 	       && !DECL_IN_SYSTEM_HEADER (fn)
  	       && strlen (reason))
  	{
  	  warning ("%Jinlining failed in call to '%F': %s", fn, fn, reason);
--- 1488,1500 ----
       inlining.  */
    if (!cgraph_inline_p (edge, &reason))
      {
!       if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (edge->caller->decl)))
  	{
! 	  sorry ("%Jinlining failed in call to '%F': %s", edge->caller->decl, fn, reason);
  	  sorry ("called from here");
  	}
!       else if (warn_inline && DECL_DECLARED_INLINE_P (edge->caller->decl)
! 	       && !DECL_IN_SYSTEM_HEADER (edge->caller->decl)
  	       && strlen (reason))
  	{
  	  warning ("%Jinlining failed in call to '%F': %s", fn, fn, reason);
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.654.2.107
diff -c -3 -p -r1.654.2.107 toplev.c
*** toplev.c	26 Mar 2004 16:22:26 -0000	1.654.2.107
--- toplev.c	28 Mar 2004 17:00:32 -0000
*************** backend_init (void)
*** 2507,2512 ****
--- 2507,2513 ----
       provide a dummy function context for them.  */
    init_dummy_function_start ();
    init_expmed ();
+   init_optimization_passes ();
    if (flag_caller_saves)
      init_caller_save ();
    expand_dummy_function_end ();
Index: passes.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/passes.c,v
retrieving revision 2.2.2.4
diff -c -3 -p -r2.2.2.4 passes.c
*** passes.c	26 Mar 2004 16:22:19 -0000	2.2.2.4
--- passes.c	28 Mar 2004 17:00:32 -0000
*************** rest_of_compilation (tree decl)
*** 1938,1949 ****
  void
  init_optimization_passes (void)
  {
!   if (flag_unit_at_a_time)
!     {
!       open_dump_file (DFI_cgraph, NULL);
!       cgraph_dump_file = dump_file;
!       dump_file = NULL;
!     }
  }
  
  void
--- 1938,1946 ----
  void
  init_optimization_passes (void)
  {
!   open_dump_file (DFI_cgraph, NULL);
!   cgraph_dump_file = dump_file;
!   dump_file = NULL;
  }
  
  void
*************** finish_optimization_passes (void)
*** 1968,1979 ****
        timevar_pop (TV_DUMP);
      }
  
!   if (flag_unit_at_a_time)
!     {
!       dump_file = cgraph_dump_file;
!       cgraph_dump_file = NULL;
!       close_dump_file (DFI_cgraph, NULL, NULL_RTX);
!     }
  
    /* Do whatever is necessary to finish printing the graphs.  */
    if (graph_dump_format != no_graph)
--- 1965,1973 ----
        timevar_pop (TV_DUMP);
      }
  
!   dump_file = cgraph_dump_file;
!   cgraph_dump_file = NULL;
!   close_dump_file (DFI_cgraph, NULL, NULL_RTX);
  
    /* Do whatever is necessary to finish printing the graphs.  */
    if (graph_dump_format != no_graph)


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