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]

[PATCH] Fix not inlining var_ann


This fixes the fact that we are appearantly not inlining the call to
var_ann.  For the testcase of PR34683 (-O -fstrict-aliasing, with all
previous posted patches applied):

Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total           
 time   seconds   seconds    calls   s/call   s/call  name    
 39.79     30.12    30.12  1311048     0.00     0.00  ggc_alloc_stat
 12.62     39.67     9.55 34186814     0.00     0.00  add_vars_for_offset
  5.77     44.04     4.37 331206978     0.00     0.00  var_ann

                0.00    0.00   35522/331206978     add_to_addressable_set 
[318]
                1.58    0.00 119702754/331206978     add_virtual_operand 
[12]
                2.79    0.00 211468702/331206978     add_vars_for_offset 
[17]
[39]     5.8    4.37    0.00 331206978         var_ann [39]
                0.00    0.00  119615/96446282     htab_find_with_hash 
<cycle 34> [46]

fixing this by shrinking the body of var_ann, retaining only the important
assertion, the compile-time of the testcase improves by 6%.  You can get
another 2.5% by removing the remaining assert (this is all with
release checking), but I don't think this is a fair trade-off.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to mainline.

Richard.

2008-01-08  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/34683
	* tree-flow-inline.h (var_ann): Remove overzealous asserts.

Index: tree-flow-inline.h
===================================================================
--- tree-flow-inline.h	(revision 131372)
+++ tree-flow-inline.h	(working copy)
@@ -190,23 +190,28 @@ fill_referenced_var_vec (VEC (tree, heap
 static inline var_ann_t
 var_ann (const_tree t)
 {
-  gcc_assert (t);
-  gcc_assert (DECL_P (t));
-  gcc_assert (TREE_CODE (t) != FUNCTION_DECL);
-  if (!MTAG_P (t) && (TREE_STATIC (t) || DECL_EXTERNAL (t)))
+  var_ann_t ann;
+
+  if (!MTAG_P (t)
+      && (TREE_STATIC (t) || DECL_EXTERNAL (t)))
     {
       struct static_var_ann_d *sann
         = ((struct static_var_ann_d *)
 	   htab_find_with_hash (gimple_var_anns (cfun), t, DECL_UID (t)));
       if (!sann)
 	return NULL;
-      gcc_assert (sann->ann.common.type == VAR_ANN);
-      return &sann->ann;
+      ann = &sann->ann;
     }
-  gcc_assert (!t->base.ann
-	      || t->base.ann->common.type == VAR_ANN);
+  else
+    {
+      if (!t->base.ann)
+	return NULL;
+      ann = (var_ann_t) t->base.ann;
+    }
+
+  gcc_assert (ann->common.type == VAR_ANN);
 
-  return (var_ann_t) t->base.ann;
+  return ann;
 }
 
 /* Return the variable annotation for T, which must be a _DECL node.


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