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 always_inline


> Thanks.  Can you also try going into SSA for -O0 and remove non-SSA
> inlining stuff if you are doing the cleanup?  This would enable flow-sensitive
> warnings at -O0 and also running TER and so getting rid of some tree-ssa -O0
> code-quality regressions.

I am planning to give SSA at -O0 try.  I guess to get it for real, we
will need to be more considerate about debug info in SSA path and we
should see how much expenses whole thing have.  Should not TER die with
tuples merge?

Honza
> 
> Thanks,
> Richard.
> 
> >  Honza
> >
> >         tree-optimization/36100
> >         * tree-pass.h (pass_O0_always_inline): Declare.
> >         * ipa-inline.c (inline_transform): Remove dead code.
> >         (cgraph_gate_O0_always_inline, cgraph_O0_always_inline,
> >         pass_O0_always_inline): New.
> >         * passes.c (init_optimization_passes): Add pass_O0_always_inline.
> >  Index: tree-pass.h
> >  ===================================================================
> >  *** tree-pass.h (revision 134890)
> >  --- tree-pass.h (working copy)
> >  *************** extern struct rtl_opt_pass pass_final;
> >  *** 501,506 ****
> >  --- 501,507 ----
> >   extern struct rtl_opt_pass pass_rtl_seqabstr;
> >   extern struct gimple_opt_pass pass_release_ssa_names;
> >   extern struct gimple_opt_pass pass_early_inline;
> >  + extern struct gimple_opt_pass pass_O0_always_inline;
> >   extern struct gimple_opt_pass pass_inline_parameters;
> >   extern struct gimple_opt_pass pass_all_early_optimizations;
> >   extern struct gimple_opt_pass pass_update_address_taken;
> >  Index: ipa-inline.c
> >  ===================================================================
> >  *** ipa-inline.c        (revision 134890)
> >  --- ipa-inline.c        (working copy)
> >  *************** inline_transform (struct cgraph_node *no
> >  *** 1588,1601 ****
> >         todo = optimize_inline_calls (current_function_decl);
> >         timevar_pop (TV_INTEGRATION);
> >       }
> >  -   /* In non-unit-at-a-time we must mark all referenced functions as needed.  */
> >  -   if (!flag_unit_at_a_time)
> >  -     {
> >  -       struct cgraph_edge *e;
> >  -       for (e = node->callees; e; e = e->next_callee)
> >  -       if (e->callee->analyzed)
> >  -           cgraph_mark_needed_node (e->callee);
> >  -     }
> >     return todo | execute_fixup_cfg ();
> >   }
> >
> >  --- 1588,1593 ----
> >  *************** struct ipa_opt_pass pass_ipa_inline =
> >  *** 1628,1631 ****
> >  --- 1620,1682 ----
> >    NULL,                                        /* variable_transform */
> >   };
> >
> >  +
> >  + /* When inlining shall be performed.  */
> >  + static bool
> >  + cgraph_gate_O0_always_inline (void)
> >  + {
> >  +   return !flag_unit_at_a_time || !flag_inline_trees;
> >  + }
> >  +
> >  + static unsigned int
> >  + cgraph_O0_always_inline (void)
> >  + {
> >  +   struct cgraph_node *node = cgraph_node (current_function_decl);
> >  +   unsigned int todo = 0;
> >  +   bool inlined;
> >  +
> >  +   if (sorrycount || errorcount)
> >  +     return 0;
> >  +   inlined = cgraph_decide_inlining_incrementally (node, INLINE_SPEED, 0);
> >  +   /* We might need the body of this function so that we can expand
> >  +      it inline somewhere else.  */
> >  +   if (cgraph_preserve_function_body_p (current_function_decl))
> >  +     save_inline_function_body (node);
> >  +   if (inlined || warn_inline)
> >  +     {
> >  +       timevar_push (TV_INTEGRATION);
> >  +       todo = optimize_inline_calls (current_function_decl);
> >  +       timevar_pop (TV_INTEGRATION);
> >  +     }
> >  +   /* In non-unit-at-a-time we must mark all referenced functions as needed.  */
> >  +   if (!flag_unit_at_a_time)
> >  +     {
> >  +       struct cgraph_edge *e;
> >  +       for (e = node->callees; e; e = e->next_callee)
> >  +       if (e->callee->analyzed)
> >  +           cgraph_mark_needed_node (e->callee);
> >  +     }
> >  +   return todo | execute_fixup_cfg ();
> >  + }
> >  +
> >  + struct gimple_opt_pass pass_O0_always_inline =
> >  + {
> >  +  {
> >  +   GIMPLE_PASS,
> >  +   "always_inline",                    /* name */
> >  +   cgraph_gate_O0_always_inline,               /* gate */
> >  +   cgraph_O0_always_inline,            /* execute */
> >  +   NULL,                                       /* sub */
> >  +   NULL,                                       /* next */
> >  +   0,                                  /* static_pass_number */
> >  +   TV_INLINE_HEURISTICS,                       /* tv_id */
> >  +   0,                                  /* properties_required */
> >  +   PROP_cfg,                           /* properties_provided */
> >  +   0,                                  /* properties_destroyed */
> >  +   0,                                  /* todo_flags_start */
> >  +   TODO_dump_func | TODO_verify_flow
> >  +   | TODO_verify_stmts                 /* todo_flags_finish */
> >  +  }
> >  + };
> >  +
> >   #include "gt-ipa-inline.h"
> >  Index: passes.c
> >  ===================================================================
> >  *** passes.c    (revision 134890)
> >  --- passes.c    (working copy)
> >  *************** init_optimization_passes (void)
> >  *** 553,558 ****
> >  --- 553,559 ----
> >     /* These passes are run after IPA passes on every function that is being
> >        output to the assembler file.  */
> >     p = &all_passes;
> >  +   NEXT_PASS (pass_O0_always_inline);
> >     NEXT_PASS (pass_all_optimizations);
> >       {
> >         struct opt_pass **p = &pass_all_optimizations.pass.sub;
> >


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