> Ping.
> 
> Thanks,
> 
> Martin
> 
> ----------------------------------------------------------------------
> On Sat, Mar 19, 2011 at 01:48:36AM +0100, Martin Jambor wrote:
> 
> Hi,
> 
> On Fri, Mar 11, 2011 at 03:30:53PM +0100, Jan Hubicka wrote:
> > > Index: src/gcc/cgraph.c
> > > ===================================================================
> > > --- src.orig/gcc/cgraph.c
> > > +++ src/gcc/cgraph.c
> > > @@ -2495,11 +2495,11 @@ cgraph_add_new_function (tree fndecl, bo
> > >        case CGRAPH_STATE_FINISHED:
> > >   /* At the very end of compilation we have to do all the work up
> > >      to expansion.  */
> > > + node = cgraph_node (fndecl);
> > > + cgraph_analyze_function (node);
> > >   push_cfun (DECL_STRUCT_FUNCTION (fndecl));
> > >   current_function_decl = fndecl;
> > >   gimple_register_cfg_hooks ();
> > > - if (!lowered)
> > > -          tree_lowering_passes (fndecl);
> > 
> > The analysis shoud happent in cgraph_process_new_functions that
> > should be called after every IPA pass.
> 
> I'm not sure I understand.  Since cgraph_state is in
> CGRAPH_STATE_FINISHED, new functions are not added to cgraph_new_nodes
> linked list to be picked up by cgraph_process_new_functions.  If you

Hmm, I missed it is FINISHED stage.  This is OK then.
> are wondering why cgraph_state has that value because mudflap passes
> are early passes and so that should not happen if the function was
> invoked from them, the explanation is simple, it is not invoked from
> them.  Instead this is some part of mudflap finalization invoked
> directly from toplev.c:
> 
> #0  fancy_abort (file=0xe07230 "/home/mjambor/icln/src/gcc/tree-inline.c", 
> line=4206,
>     function=0xe08860 "optimize_inline_calls") at 
> /home/mjambor/icln/src/gcc/diagnosti
> c.c:892                                                                       
>         
> #1  0x0000000000a4ce05 in optimize_inline_calls (fn=0x7ffff5237f00)           
>         
>     at /home/mjambor/icln/src/gcc/tree-inline.c:4206                          
>       
> #2  0x0000000000a1d802 in cgraph_early_inlining ()                            
>         
>     at /home/mjambor/icln/src/gcc/ipa-inline.c:1757                           
>       
> #3  0x0000000000756ccf in execute_one_pass (pass=0x1255a00)                   
>         
>     at /home/mjambor/icln/src/gcc/passes.c:1556                               
>       
> #4  0x0000000000756fc5 in execute_pass_list (pass=0x1255a00)
>     at /home/mjambor/icln/src/gcc/passes.c:1611
> #5  0x0000000000a08518 in cgraph_add_new_function (fndecl=0x7ffff5237f00, 
> lowered=0 '\000')
>     at /home/mjambor/icln/src/gcc/cgraph.c:2505
> #6  0x0000000000a342bf in cgraph_build_static_cdtor_1 (which=73 'I', 
> body=0x7ffff53e0820,
>     priority=<value optimized out>, final=0 '\000') at 
> /home/mjambor/icln/src/gcc/ipa.c:1593
> #7  0x00000000004e2683 in mudflap_finish_file ()

It would be prettier if this all happent earlier and from PM control.  I see
that mudflap_2 is currently done quite late and apparently whatever fnish_file
constructs depends on mudflap_2.  My understanding is that it should pretty
much work same way if it was moved post early optimization and this finish_file
became small IPA pass just after early passes.  But this is independent of the
issue above. 

>     at /home/mjambor/icln/src/gcc/tree-mudflap.c:1366
> #8  0x00000000007fe3f9 in compile_file (argc=34, argv=0x7fffffffddf8)
>     at /home/mjambor/icln/src/gcc/toplev.c:601
> #9  do_compile (argc=34, argv=0x7fffffffddf8) at 
> /home/mjambor/icln/src/gcc/toplev.c:1900
> #10 toplev_main (argc=34, argv=0x7fffffffddf8) at 
> /home/mjambor/icln/src/gcc/toplev.c:1963
> 
> > I don't think we should move
> > analysis here nor we should drop the !lowered path (even if it is
> > unused currently, cgraph_add_new_function is supposed to work on
> > unlowered functions).
> 
> I'm not really dropping that path.  cgraph_analyze_function calls
> cgraph_lower_function which calls tree_lowering_passes.  It even calls
> lower_nested_functions and, perhaps more importantly, sets
> node->lowered to true.  But I see that lowered is actually a function
> parameter that we should honor so I adjusted my patch slightly to do
> that.

Hmm, seems fine.
> 
> 2011-03-18  Martin Jambor  <mjam...@suse.cz>
> 
>       * tree-inline.c (expand_call_inline): Do not check that destination
>       node is analyzed.
>       (optimize_inline_calls): Assert that destination node is analyzed.
>       * cgraph.c (cgraph_add_new_function): Call cgraph_analyze_function, do
>       not call tree_lowering_passes.
>       * cgraph.h (cgraph_analyze_function): Declare.
>       * cgraphunit.c (cgraph_analyze_function): Make public.
OK. Thanks.
Honza

Reply via email to