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]

[PR c++/90613] Fix using-decl debug bloat


My patch reorganizing using decl handling caused a regression in the size of debug information. The culprit was that we were passing an overload set when previously we'd pass a single decl. And that broke an elision test.

Fixed by moving that test into the iteration of the overload set.

Martin was kind enough to provide a reduced testcase, and I've verified that the debug info on one of the benchmarks reported has returned to what it was.

The testcase isn't in the g++.dg/debug directory, because that unconditionally iterates over different debug formats, and I only wanted to check dwarf, because I know how to do that :)

Committing to trunk.

nathan
--
Nathan Sidwell
2019-08-28  Nathan Sidwell  <nathan@acm.org>

	cp/
	PR c++/90613
	* name-lookup.c (cp_emit_debug_info): Check for builtins during
	overload iteration.

2019-08-16  Martin Liska  <mliska@suse.cz>

	testsuite/
	PR c++/90613
	* g++.dg/lookup/using61.C: New.

Index: gcc/cp/name-lookup.c
===================================================================
--- gcc/cp/name-lookup.c	(revision 274930)
+++ gcc/cp/name-lookup.c	(working copy)
@@ -7456,11 +7456,4 @@ cp_emit_debug_info_for_using (tree t, tr
     return;
 
-  /* Ignore this FUNCTION_DECL if it refers to a builtin declaration
-     of a builtin function.  */
-  if (TREE_CODE (t) == FUNCTION_DECL
-      && DECL_EXTERNAL (t)
-      && fndecl_built_in_p (t))
-    return;
-
   /* Do not supply context to imported_module_or_decl, if
      it is a global namespace.  */
@@ -7470,16 +7463,24 @@ cp_emit_debug_info_for_using (tree t, tr
   t = MAYBE_BASELINK_FUNCTIONS (t);
 
-  /* FIXME: Handle TEMPLATE_DECLs.  */
   for (lkp_iterator iter (t); iter; ++iter)
     {
       tree fn = *iter;
-      if (TREE_CODE (fn) != TEMPLATE_DECL)
-	{
-	  if (building_stmt_list_p ())
-	    add_stmt (build_stmt (input_location, USING_STMT, fn));
-	  else
-	    debug_hooks->imported_module_or_decl (fn, NULL_TREE, context,
-						  false, false);
-	}
+
+      if (TREE_CODE (fn) == TEMPLATE_DECL)
+	/* FIXME: Handle TEMPLATE_DECLs.  */
+	continue;
+      
+      /* Ignore this FUNCTION_DECL if it refers to a builtin declaration
+	 of a builtin function.  */
+      if (TREE_CODE (fn) == FUNCTION_DECL
+	  && DECL_EXTERNAL (fn)
+	  && fndecl_built_in_p (fn))
+	continue;
+
+      if (building_stmt_list_p ())
+	add_stmt (build_stmt (input_location, USING_STMT, fn));
+      else
+	debug_hooks->imported_module_or_decl (fn, NULL_TREE, context,
+					      false, false);
     }
 }
Index: gcc/testsuite/g++.dg/lookup/using61.C
===================================================================
--- gcc/testsuite/g++.dg/lookup/using61.C	(revision 0)
+++ gcc/testsuite/g++.dg/lookup/using61.C	(working copy)
@@ -0,0 +1,8 @@
+// { dg-options "-gdwarf-2" }
+/* { dg-skip-if "No Dwarf" { { *-*-aix* hppa*-*-hpux* } && { ! hppa*64*-*-* } } } */
+
+extern "C" long double nanl(const char *);
+using ::nanl;
+
+// We should elide the using for this extern C builtin
+// { dg-final { scan-assembler-not ".debug_info" } }

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