This is the mail archive of the gcc-bugs@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]

[Bug rtl-optimization/28071] [4.1/4.2 regression] A file that can not be compiled in reasonable time/space



------- Comment #10 from hubicka at ucw dot cz  2006-07-22 13:47 -------
Subject: Re:  [4.1/4.2 regression] A file that can not be compiled in
reasonable time/space

Hi,
this patch makes the -O2 case work pretty well on tree side.  Inliner
expands code from 8MB to 40MB of GGC memory that seems under control.
Aliasing peaks at 85MB that also don't seem completely unresonable.
I will need to give it more testing.  I believe inliner is always ggc
safe but it is easy to be mistaken here.
The patch also speeds up the inline heuristic by prunning out the
impossible edges early making the priority queue smaller.
Also I am quite curious how inliner manages to produce 800MB of
garbage...

Honza

Index: ipa-inline.c
===================================================================
*** ipa-inline.c        (revision 115645)
--- ipa-inline.c        (working copy)
*************** update_caller_keys (fibheap_t heap, stru
*** 413,418 ****
--- 413,419 ----
                    bitmap updated_nodes)
  {
    struct cgraph_edge *edge;
+   const char *failed_reason;

    if (!node->local.inlinable || node->local.disregard_inline_limits
        || node->global.inlined_to)
*************** update_caller_keys (fibheap_t heap, stru
*** 421,426 ****
--- 422,441 ----
      return;
    bitmap_set_bit (updated_nodes, node->uid);
    node->global.estimated_growth = INT_MIN;
+ 
+   if (!node->local.inlinable)
+     return;
+   /* Prune out edges we won't inline into anymore.  */
+   if (!cgraph_default_inline_p (node, &failed_reason))
+     {
+       for (edge = node->callers; edge; edge = edge->next_caller)
+       if (edge->aux)
+         {
+           fibheap_delete_node (heap, edge->aux);
+           edge->aux = NULL;
+         }
+       return;
+     }

    for (edge = node->callers; edge; edge = edge->next_caller)
      if (edge->inline_failed)
Index: tree-inline.c
===================================================================
*** tree-inline.c       (revision 115645)
--- tree-inline.c       (working copy)
*************** expand_call_inline (basic_block bb, tree
*** 2163,2172 ****
    /* Update callgraph if needed.  */
    cgraph_remove_node (cg_edge->callee);

-   /* Declare the 'auto' variables added with this inlined body.  */
-   record_vars (BLOCK_VARS (id->block));
    id->block = NULL_TREE;
    successfully_inlined = TRUE;

   egress:
    input_location = saved_location;
--- 2163,2171 ----
    /* Update callgraph if needed.  */
    cgraph_remove_node (cg_edge->callee);

    id->block = NULL_TREE;
    successfully_inlined = TRUE;
+   ggc_collect ();

   egress:
    input_location = saved_location;
*************** declare_inline_vars (tree block, tree va
*** 2556,2562 ****
  {
    tree t;
    for (t = vars; t; t = TREE_CHAIN (t))
!     DECL_SEEN_IN_BIND_EXPR_P (t) = 1;

    if (block)
      BLOCK_VARS (block) = chainon (BLOCK_VARS (block), vars);
--- 2555,2567 ----
  {
    tree t;
    for (t = vars; t; t = TREE_CHAIN (t))
!     {
!       DECL_SEEN_IN_BIND_EXPR_P (t) = 1;
!       gcc_assert (!TREE_STATIC (t) && !TREE_ASM_WRITTEN (t));
!       cfun->unexpanded_var_list =
!       tree_cons (NULL_TREE, t,
!                  cfun->unexpanded_var_list);
!     }

    if (block)
      BLOCK_VARS (block) = chainon (BLOCK_VARS (block), vars);


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28071


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