Found while building our internal code base with -ftime-report.  This
patch is against google/gcc-4_6, but the bug also exists in 4.7 and
gcc-4_6-branch.

OK for gcc-4_6-branch and trunk?

Tested on x86_64.  Applied to google/gcc-4_6.


Diego.

        * name-lookup.c (lookup_arg_dependent): Use conditional
        timevars.
        * decl.c (xref_tag): Likewise.
        * call.c (build_op_call): Likewise.

Index: cp/decl.c
===================================================================
--- cp/decl.c   (revision 177856)
+++ cp/decl.c   (working copy)
@@ -11354,9 +11354,10 @@ xref_tag (enum tag_types tag_code, tree 
           tag_scope scope, bool template_header_p)
 {
   tree ret;
-  timevar_start (TV_NAME_LOOKUP);
+  bool subtime;
+  subtime = timevar_cond_start (TV_NAME_LOOKUP);
   ret = xref_tag_1 (tag_code, name, scope, template_header_p);
-  timevar_stop (TV_NAME_LOOKUP);
+  timevar_cond_stop (TV_NAME_LOOKUP, subtime);
   return ret;
 }
 
Index: cp/call.c
===================================================================
--- cp/call.c   (revision 177856)
+++ cp/call.c   (working copy)
@@ -3965,9 +3965,10 @@ tree
 build_op_call (tree obj, VEC(tree,gc) **args, tsubst_flags_t complain)
 {
   tree ret;
-  timevar_start (TV_OVERLOAD);
+  bool subtime;
+  subtime = timevar_cond_start (TV_OVERLOAD);
   ret = build_op_call_1 (obj, args, complain);
-  timevar_stop (TV_OVERLOAD);
+  timevar_cond_stop (TV_OVERLOAD, subtime);
   return ret;
 }
 
Index: cp/name-lookup.c
===================================================================
--- cp/name-lookup.c    (revision 177856)
+++ cp/name-lookup.c    (working copy)
@@ -5441,9 +5441,10 @@ lookup_arg_dependent (tree name, tree fn
                       bool include_std)
 {
   tree ret;
-  timevar_start (TV_NAME_LOOKUP);
+  bool subtime;
+  subtime = timevar_cond_start (TV_NAME_LOOKUP);
   ret = lookup_arg_dependent_1 (name, fns, args, include_std);
-  timevar_stop (TV_NAME_LOOKUP);
+  timevar_cond_stop (TV_NAME_LOOKUP, subtime);
   return ret;
 }
 

--
This patch is available for review at http://codereview.appspot.com/4894054

Reply via email to