public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PR c++/90613] Fix using-decl debug bloat
@ 2019-08-28 13:56 Nathan Sidwell
  2019-08-28 18:57 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Sidwell @ 2019-08-28 13:56 UTC (permalink / raw)
  To: GCC Patches, Martin Liška

[-- Attachment #1: Type: text/plain, Size: 689 bytes --]

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

[-- Attachment #2: 90613.diff --]
[-- Type: text/x-patch, Size: 2355 bytes --]

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" } }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PR c++/90613] Fix using-decl debug bloat
  2019-08-28 13:56 [PR c++/90613] Fix using-decl debug bloat Nathan Sidwell
@ 2019-08-28 18:57 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2019-08-28 18:57 UTC (permalink / raw)
  To: Nathan Sidwell; +Cc: GCC Patches, Martin Liška

On Wed, Aug 28, 2019 at 9:35 AM Nathan Sidwell <nathan@acm.org> wrote:
>
> 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 :)

FYI there is the g++.dg/debug/dwarf2 directory for dwarf tests.

Jason

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-28 17:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-28 13:56 [PR c++/90613] Fix using-decl debug bloat Nathan Sidwell
2019-08-28 18:57 ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).