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]

Re: Fix inliner WRT indirect calls


> On Sun, May 10, 2009 at 8:17 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
> > Hi,
> > this patch fixes two problems in inliner. ?First estimate_move_cost is called on
> > VOID types in code estimating cost of call funptr(); and it returns non-trivial
> > cost since size of VOID is -1 and it thinks that memcpy loop will be needed.
> > Second since we are now able to keep cgraph intact in inlining, I added verification
> > and also removal of unreachable blocks so we don't have stale edges after execution.
> >
> > These two changes are needed to make early inliner handle indirect calls correctly.
> >
> > Bootstrappe/regtested x86_64-linux, will commit it shortly.
> > ? ? ? ?* tree-inline.c (delete_unreachable_blocks_update_callgraph): Declare.
> > ? ? ? ?(estimate_move_cost): Assert that it does not get called for VOID_TYPE_P.
> > ? ? ? ?(estimate_num_insns): Skip VOID types in argument handling.
> > ? ? ? ?(optimize_inline_calls): Delete unreachable blocks and verify that
> > ? ? ? ?callgraph is valid.
> 
> This caused:
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40095

It is extra warning with -Wunreachable.  This is latent bug in
-Wunrechable wrt complette loop unrolling (every complettely unrolled
loop with exit condition not being last stmt will trigger such warning).

With flatten-2, I would propose following patch.
The testcase tests that inliner behaves sanely with flatten on cyclic
graph, that is that for flattened cyclic graph it breaks the cycle
on particular place.  THis is not the case with early inlining that
brings in functions without knowing about SCCs of callgraph and flatten
attributes.  I think it is OK, since we don't promise anything on
flatten and cyclic graph and the behaviour is still sane.
So if there are no complains, I will commit this tomorrow.

	* gcc.dg/tree-ssa/flatten-2.c: Add -fno-early-inlining.
Index: testsuite/gcc.dg/tree-ssa/flatten-2.c
===================================================================
*** testsuite/gcc.dg/tree-ssa/flatten-2.c	(revision 147349)
--- testsuite/gcc.dg/tree-ssa/flatten-2.c	(working copy)
***************
*** 1,5 ****
  /* { dg-do compile } */
! /* { dg-options -O2 } */
  
  extern void do_something_usefull();
  /* Check that we finish compiling even if instructed to
--- 1,5 ----
  /* { dg-do compile } */
! /* { dg-options -O2 -fno-early-inlining } */
  
  extern void do_something_usefull();
  /* Check that we finish compiling even if instructed to


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