* ipa-inline-analysis.c (inline_summary_alloc): Bounds check.
authorJan Hubicka <jh@suse.cz>
Sun, 2 Oct 2011 14:28:18 +0000 (16:28 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sun, 2 Oct 2011 14:28:18 +0000 (14:28 +0000)
From-SVN: r179428

gcc/ChangeLog
gcc/ipa-inline-analysis.c

index e556b12..b8eef47 100644 (file)
@@ -1,5 +1,7 @@
 2011-10-02  Jan Hubicka  <jh@suse.cz>
 
+       * ipa-inline-analysis.c (inline_summary_alloc): Bounds check.
+
        * ipa-inline-analysis.c (reset_inline_edge_summary): New function.
        (reset_inline_summary): New function.
        (compute_inline_parameters, inline_node_removal_hook,
index 4e97943..8499cb5 100644 (file)
@@ -795,13 +795,17 @@ inline_summary_alloc (void)
 static void
 reset_inline_edge_summary (struct cgraph_edge *e)
 {
-  struct inline_edge_summary *es = inline_edge_summary (e);
+  if (e->uid
+      < (int)VEC_length (inline_edge_summary_t, inline_edge_summary_vec))
+    {
+      struct inline_edge_summary *es = inline_edge_summary (e);
 
-  es->call_stmt_size = es->call_stmt_time =0;
-  if (es->predicate)
-    pool_free (edge_predicate_pool, es->predicate);
-  es->predicate = NULL;
-  VEC_free (inline_param_summary_t, heap, es->param);
+      es->call_stmt_size = es->call_stmt_time =0;
+      if (es->predicate)
+       pool_free (edge_predicate_pool, es->predicate);
+      es->predicate = NULL;
+      VEC_free (inline_param_summary_t, heap, es->param);
+    }
 }
 
 /* We are called multiple time for given function; clear
@@ -1044,9 +1048,7 @@ inline_edge_removal_hook (struct cgraph_edge *edge, void *data ATTRIBUTE_UNUSED)
 {
   if (edge_growth_cache)
     reset_edge_growth_cache (edge);
-  if (edge->uid
-      < (int)VEC_length (inline_edge_summary_t, inline_edge_summary_vec))
-    reset_inline_edge_summary (edge);
+  reset_inline_edge_summary (edge);
 }