Sophie

Sophie

distrib > Mageia > 1 > i586 > by-pkgid > f817bc4609513461d0c886e219afdbeb > files > 41

gcc-4.5.2-4.mga1.src.rpm

From 73b465171affe4b630e14d526b13143300057d91 Mon Sep 17 00:00:00 2001
From: ramana <ramana@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Thu, 8 Jul 2010 09:29:43 +0000
Subject: [PATCH] Fix PR44768

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161947 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog     |    9 +++++++++
 gcc/cfgexpand.c   |   12 ++++++++----
 gcc/ipa-inline.c  |    2 +-
 gcc/tree-inline.h |    2 +-
 4 files changed, 19 insertions(+), 6 deletions(-)

Index: gcc-4.5.2/gcc/cfgexpand.c
===================================================================
--- gcc-4.5.2.orig/gcc/cfgexpand.c
+++ gcc-4.5.2/gcc/cfgexpand.c
@@ -1242,8 +1242,8 @@ fini_vars_expansion (void)
   stack_vars_alloc = stack_vars_num = 0;
 }
 
-/* Make a fair guess for the size of the stack frame of the current
-   function.  This doesn't have to be exact, the result is only used
+/* Make a fair guess for the size of the stack frame of the decl
+   passed.  This doesn't have to be exact, the result is only used
    in the inline heuristics.  So we don't want to run the full stack
    var packing algorithm (which is quadratic in the number of stack
    vars).  Instead, we calculate the total size of all stack vars.
@@ -1251,11 +1251,14 @@ fini_vars_expansion (void)
    vars doesn't happen very often.  */
 
 HOST_WIDE_INT
-estimated_stack_frame_size (void)
+estimated_stack_frame_size (tree decl)
 {
   HOST_WIDE_INT size = 0;
   size_t i;
   tree t, outer_block = DECL_INITIAL (current_function_decl);
+  tree old_cur_fun_decl = current_function_decl;
+  current_function_decl = decl;
+  push_cfun (DECL_STRUCT_FUNCTION (decl));
 
   init_vars_expansion ();
 
@@ -1278,7 +1281,8 @@ estimated_stack_frame_size (void)
       size += account_stack_vars ();
       fini_vars_expansion ();
     }
-
+  pop_cfun ();
+  current_function_decl = old_cur_fun_decl;
   return size;
 }
 
Index: gcc-4.5.2/gcc/ipa-inline.c
===================================================================
--- gcc-4.5.2.orig/gcc/ipa-inline.c
+++ gcc-4.5.2/gcc/ipa-inline.c
@@ -1967,7 +1967,7 @@ compute_inline_parameters (struct cgraph
 
   /* Estimate the stack size for the function.  But not at -O0
      because estimated_stack_frame_size is a quadratic problem.  */
-  self_stack_size = optimize ? estimated_stack_frame_size () : 0;
+  self_stack_size = optimize ? estimated_stack_frame_size (node->decl) : 0;
   inline_summary (node)->estimated_self_stack_size = self_stack_size;
   node->global.estimated_stack_size = self_stack_size;
   node->global.stack_frame_offset = 0;
Index: gcc-4.5.2/gcc/tree-inline.h
===================================================================
--- gcc-4.5.2.orig/gcc/tree-inline.h
+++ gcc-4.5.2/gcc/tree-inline.h
@@ -187,6 +187,6 @@ extern tree remap_decl (tree decl, copy_
 extern tree remap_type (tree type, copy_body_data *id);
 extern gimple_seq copy_gimple_seq_and_replace_locals (gimple_seq seq);
 
-extern HOST_WIDE_INT estimated_stack_frame_size (void);
+extern HOST_WIDE_INT estimated_stack_frame_size (tree);
 
 #endif /* GCC_TREE_INLINE_H */