* statistics.c (statistics_counter_event): Do not record event
authorabel <abel@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Jun 2009 14:36:47 +0000 (14:36 +0000)
committerabel <abel@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Jun 2009 14:36:47 +0000 (14:36 +0000)
        in pass dump if its number == -1.
        (curr_statistics_hash): Add assert that we never get passes
        with static number == -1.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148131 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/statistics.c

index dd1816e..523c161 100644 (file)
@@ -1,3 +1,10 @@
+2009-06-03  Andrey Belevantsev  <abel@ispras.ru>
+
+       * statistics.c (statistics_counter_event): Do not record event 
+       in pass dump if its number == -1.
+       (curr_statistics_hash): Add assert that we never get passes 
+       with static number == -1.
+
 2009-06-03  Richard Guenther  <rguenther@suse.de>
            Andrey Belevantsev  <abel@ispras.ru>
 
index d2f665f..b7bfd45 100644 (file)
@@ -82,7 +82,10 @@ hash_statistics_free (void *p)
 static htab_t
 curr_statistics_hash (void)
 {
-  unsigned idx = current_pass->static_pass_number;
+  unsigned idx;
+
+  gcc_assert (current_pass->static_pass_number >= 0);
+  idx = current_pass->static_pass_number;
 
   if (idx < nr_statistics_hashes
       && statistics_hashes[idx] != NULL)
@@ -294,9 +297,12 @@ statistics_counter_event (struct function *fn, const char *id, int incr)
       || incr == 0)
     return;
 
-  counter = lookup_or_add_counter (curr_statistics_hash (), id, 0, false);
-  gcc_assert (!counter->histogram_p);
-  counter->count += incr;
+  if (current_pass->static_pass_number != -1)
+    {
+      counter = lookup_or_add_counter (curr_statistics_hash (), id, 0, false);
+      gcc_assert (!counter->histogram_p);
+      counter->count += incr;
+    }
 
   if (!statistics_dump_file
       || !(statistics_dump_flags & TDF_DETAILS))