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]

[PATCH] Fix profile_quality sanity check.


Hi.

Following patch adds a new enum value so that we don't see following warning:
https://gcc.gnu.org/ml/gcc-patches/2018-01/msg01211.html

Apart from that I decided to not to number values of the enum as it uses
default number. Is it welcome?

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready to be installed?
Martin

gcc/ChangeLog:

2018-01-18  Martin Liska  <mliska@suse.cz>

	* profile-count.h (enum profile_quality): Add
	profile_uninitialized as the first value. Do not number values
	as they are zero based.
---
 gcc/profile-count.h | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)


diff --git a/gcc/profile-count.h b/gcc/profile-count.h
index 7a43917ebbc..e899963118b 100644
--- a/gcc/profile-count.h
+++ b/gcc/profile-count.h
@@ -26,34 +26,36 @@ struct function;
 /* Quality of the profile count.  Because gengtype does not support enums
    inside of classes, this is in global namespace.  */
 enum profile_quality {
+  /* Uninitialized value.  */
+  profile_uninitialized,
   /* Profile is based on static branch prediction heuristics and may
      or may not match reality.  It is local to function and can not be compared
      inter-procedurally.  Never used by probabilities (they are always local).
    */
-  profile_guessed_local = 1,
+  profile_guessed_local,
   /* Profile was read by feedback and was 0, we used local heuristics to guess
      better.  This is the case of functions not run in profile fedback.
      Never used by probabilities.  */
-  profile_guessed_global0 = 2,
+  profile_guessed_global0,
 
   /* Same as profile_guessed_global0 but global count is adjusted 0.  */
-  profile_guessed_global0adjusted = 3,
+  profile_guessed_global0adjusted,
 
   /* Profile is based on static branch prediction heuristics.  It may or may
      not reflect the reality but it can be compared interprocedurally
      (for example, we inlined function w/o profile feedback into function
       with feedback and propagated from that).
      Never used by probablities.  */
-  profile_guessed = 4,
+  profile_guessed,
   /* Profile was determined by autofdo.  */
-  profile_afdo = 5,
+  profile_afdo,
   /* Profile was originally based on feedback but it was adjusted
      by code duplicating optimization.  It may not precisely reflect the
      particular code path.  */
-  profile_adjusted = 6,
+  profile_adjusted,
   /* Profile was read from profile feedback or determined by accurate static
      method.  */
-  profile_precise = 7
+  profile_precise
 };
 
 /* The base value for branch probability notes and edge probabilities.  */


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