public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Do not drop PURE/CONST flags when reading profile feedback
@ 2015-10-12  6:02 Jan Hubicka
  0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2015-10-12  6:02 UTC (permalink / raw)
  To: gcc-patches, dje.gcc

Hi,
tree_profiling clears PURE/CONST flags on all functions it touches.  This is
from the times when optimization and instrumentation was mixed and it was
necessary to keep things synchronized so early optimization of later functions
is not affected by the instrumentation.  This is no longer case for several
years.

I also added a dump to tree profile pass since it is only time one can
see the CFG with profile in it prior going to LTO.

Profiledbootstrapped/regtested ppc64le-linux.

Honza
	* tree-profile.c (tree_profiling): Do not clear
	pure/const when not instrumenting.
	(pass tree_profile): Add dump of symtab.
Index: tree-profile.c
===================================================================
--- tree-profile.c	(revision 228684)
+++ tree-profile.c	(working copy)
@@ -564,20 +564,21 @@
     }
 
   /* Drop pure/const flags from instrumented functions.  */
-  FOR_EACH_DEFINED_FUNCTION (node)
-    {
-      if (!gimple_has_body_p (node->decl)
-	  || !(!node->clone_of
-	  || node->decl != node->clone_of->decl))
-	continue;
+  if (profile_arc_flag || flag_test_coverage)
+    FOR_EACH_DEFINED_FUNCTION (node)
+      {
+	if (!gimple_has_body_p (node->decl)
+	    || !(!node->clone_of
+	    || node->decl != node->clone_of->decl))
+	  continue;
 
-      /* Don't profile functions produced for builtin stuff.  */
-      if (DECL_SOURCE_LOCATION (node->decl) == BUILTINS_LOCATION)
-	continue;
+	/* Don't profile functions produced for builtin stuff.  */
+	if (DECL_SOURCE_LOCATION (node->decl) == BUILTINS_LOCATION)
+	  continue;
 
-      node->set_const_flag (false, false);
-      node->set_pure_flag (false, false);
-    }
+	node->set_const_flag (false, false);
+	node->set_pure_flag (false, false);
+      }
 
   /* Update call statements and rebuild the cgraph.  */
   FOR_EACH_DEFINED_FUNCTION (node)
@@ -633,7 +634,7 @@
   0, /* properties_provided */
   0, /* properties_destroyed */
   0, /* todo_flags_start */
-  0, /* todo_flags_finish */
+  TODO_dump_symtab, /* todo_flags_finish */
 };
 
 class pass_ipa_tree_profile : public simple_ipa_opt_pass

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-10-12  6:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-12  6:02 Do not drop PURE/CONST flags when reading profile feedback Jan Hubicka

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).