diff mbox series

Do not load body for alias symbols.

Message ID e8783f38-a5bf-6fd2-3467-78994ce697d1@suse.cz
State New
Headers show
Series Do not load body for alias symbols. | expand

Commit Message

Martin Liška Feb. 4, 2020, 3:20 p.m. UTC
Hi.

The patch is about not loading of LTO bodies for symbols
that are only aliases.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

gcc/lto/ChangeLog:

2020-02-04  Martin Liska  <mliska@suse.cz>

	PR lto/93489
	* lto-dump.c (dump_list_functions): Do not
	load body for aliases.
	(dump_body): Likewise here.
---
  gcc/lto/lto-dump.c | 22 ++++++++++++----------
  1 file changed, 12 insertions(+), 10 deletions(-)

Comments

Jan Hubicka Feb. 4, 2020, 3:29 p.m. UTC | #1
> Hi.
> 
> The patch is about not loading of LTO bodies for symbols
> that are only aliases.
> 
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> 
> Ready to be installed?
> Thanks,
> Martin
> 
> gcc/lto/ChangeLog:
> 
> 2020-02-04  Martin Liska  <mliska@suse.cz>
> 
> 	PR lto/93489
> 	* lto-dump.c (dump_list_functions): Do not
> 	load body for aliases.
> 	(dump_body): Likewise here.
OK,
thanks!
Honza
diff mbox series

Patch

diff --git a/gcc/lto/lto-dump.c b/gcc/lto/lto-dump.c
index 2983c22fdd5..96e26d9e81c 100644
--- a/gcc/lto/lto-dump.c
+++ b/gcc/lto/lto-dump.c
@@ -122,7 +122,7 @@  public:
     cgraph_node *cnode = dyn_cast<cgraph_node *> (node);
     gcc_assert (cnode);
 
-    return (cnode->definition)
+    return (cnode->definition && !cnode->alias)
      ? n_basic_blocks_for_fn (DECL_STRUCT_FUNCTION (cnode->decl))
      : 0;
   }
@@ -157,10 +157,10 @@  void dump_list_functions (void)
   cgraph_node *cnode;
   FOR_EACH_FUNCTION (cnode)
   {
-    if (cnode->definition)
+    if (cnode->definition && !cnode->alias)
       cnode->get_untransformed_body ();
     symbol_entry *e = new function_entry (cnode);
-    if (!flag_lto_dump_defined || cnode->definition)
+    if (!flag_lto_dump_defined || (cnode->definition && !cnode->alias))
       v.safe_push (e);
   }
 
@@ -260,13 +260,15 @@  void dump_body ()
   }
   cgraph_node *cnode;
   FOR_EACH_FUNCTION (cnode)
-  if (cnode->definition && !strcmp (cnode->name (), flag_dump_body))
-  {
-    printf ("Gimple Body of Function: %s\n", cnode->name ());
-    cnode->get_untransformed_body ();
-    debug_function (cnode->decl, flags);
-    flag = 1;
-  }
+    if (cnode->definition
+	&& !cnode->alias
+	&& !strcmp (cnode->name (), flag_dump_body))
+      {
+	printf ("Gimple Body of Function: %s\n", cnode->name ());
+	cnode->get_untransformed_body ();
+	debug_function (cnode->decl, flags);
+	flag = 1;
+      }
   if (!flag)
     error_at (input_location, "Function not found.");
   return;