diff mbox series

[COMMITTED,3/3] Split --param=evrp-mode into evrp-mode and ranger-debug.

Message ID d9d1a816-b571-fc09-feb1-36918326e057@redhat.com
State New
Headers show
Series [COMMITED,1/3] Move ranger only VRP folder to tree-vrp. | expand

Commit Message

Andrew MacLeod Oct. 21, 2021, 1:32 p.m. UTC
Should have done this a while ago.  With ranger being utilized in other 
places, tying the debug output mode with the EVRP mode no longer makes 
sense.

This patch splits the current --param=evrp-mode values into "evrp-mode" 
and "ranger-debug".   After this patch, valid values are:

--param=evrp-mode=[legacy|ranger|legacy-first|ranger-first] default is 
"ranger"
--param=ranger-debug=[none|trace|gori|cache|tracegori|all] default is "none"

Again, this provides no real functional changes.

Bootstrapped on x86_64-pc-linux-gnu with no regressions.  Pushed.
diff mbox series

Patch

From 9cb114fd5550eb02dfd6b8db5cb5b8fb72827d53 Mon Sep 17 00:00:00 2001
From: Andrew MacLeod <amacleod@redhat.com>
Date: Tue, 19 Oct 2021 14:09:51 -0400
Subject: [PATCH 3/3] Split --param=evrp-mode into evrp-mode and ranger-debug.

With Ranger being used in more than EVRP, the debug output should no longer
be tied up with the EVRP mode flag.

	* doc/invoke.texi (ranger-debug): Document.
	* flag-types.h (enum ranger_debug): New.
	(enum evrp_mode): Remove debug values.
	* gimple-range-cache.cc (DEBUG_RANGE_CACHE): Use new debug flag.
	* gimple-range-gori.cc (gori_compute::gori_compute): Ditto.
	* gimple-range.cc (gimple_ranger::gimple_ranger): Ditto.
	* gimple-ssa-evrp.c (hybrid_folder::choose_value): Ditto.
	(execute_early_vrp): Use evrp-mode directly.
	* params.opt (enum evrp_mode): Remove debug values.
	(ranger-debug): New.
	(ranger-logical-depth): Relocate to be in alphabetical order.
---
 gcc/doc/invoke.texi       |  3 +++
 gcc/flag-types.h          | 24 +++++++++++-------
 gcc/gimple-range-cache.cc |  4 +--
 gcc/gimple-range-gori.cc  |  2 +-
 gcc/gimple-range.cc       |  2 +-
 gcc/gimple-ssa-evrp.c     |  6 ++---
 gcc/params.opt            | 52 +++++++++++++++++++++++----------------
 7 files changed, 56 insertions(+), 37 deletions(-)

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index b89f9b61f9c..c66a25fcd69 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -14510,6 +14510,9 @@  Specifies the mode VRP pass 1 should operate in.
 @item vrp2-mode
 Specifies the mode VRP pass 2 should operate in.
 
+@item ranger-debug
+Specifies the type of debug output to be issued for ranges.
+
 @item evrp-switch-limit
 Specifies the maximum number of switch cases before EVRP ignores a switch.
 
diff --git a/gcc/flag-types.h b/gcc/flag-types.h
index 9f104e43d40..a5a637160d7 100644
--- a/gcc/flag-types.h
+++ b/gcc/flag-types.h
@@ -449,18 +449,24 @@  enum parloops_schedule_type
   PARLOOPS_SCHEDULE_RUNTIME
 };
 
+/* Ranger debug mode.  */
+enum ranger_debug
+{
+  RANGER_DEBUG_NONE = 0,
+  RANGER_DEBUG_TRACE = 1,
+  RANGER_DEBUG_CACHE = (2 | RANGER_DEBUG_TRACE),
+  RANGER_DEBUG_GORI = 4,
+  RANGER_DEBUG_TRACE_GORI = (RANGER_DEBUG_TRACE | RANGER_DEBUG_GORI),
+  RANGER_DEBUG_ALL = (RANGER_DEBUG_GORI | RANGER_DEBUG_CACHE)
+};
+
 /* EVRP mode.  */
 enum evrp_mode
 {
-  EVRP_MODE_RVRP_ONLY = 0,
-  EVRP_MODE_EVRP_ONLY = 1,
-  EVRP_MODE_EVRP_FIRST = 2,
-  EVRP_MODE_RVRP_FIRST = 3,
-  EVRP_MODE_TRACE = 4,
-  EVRP_MODE_CACHE = (8 | EVRP_MODE_TRACE),
-  EVRP_MODE_GORI = 16,
-  EVRP_MODE_TRACE_GORI = (EVRP_MODE_TRACE | EVRP_MODE_GORI),
-  EVRP_MODE_DEBUG = (EVRP_MODE_GORI | EVRP_MODE_CACHE)
+  EVRP_MODE_RVRP_ONLY,
+  EVRP_MODE_EVRP_ONLY,
+  EVRP_MODE_EVRP_FIRST,
+  EVRP_MODE_RVRP_FIRST
 };
 
 /* VRP modes.  */
diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc
index 9cbc63d8a40..05010cf15bc 100644
--- a/gcc/gimple-range-cache.cc
+++ b/gcc/gimple-range-cache.cc
@@ -30,8 +30,8 @@  along with GCC; see the file COPYING3.  If not see
 #include "gimple-range.h"
 #include "tree-cfg.h"
 
-#define DEBUG_RANGE_CACHE (dump_file && (param_evrp_mode & EVRP_MODE_CACHE) \
-					 == EVRP_MODE_CACHE)
+#define DEBUG_RANGE_CACHE (dump_file					\
+			   && (param_ranger_debug & RANGER_DEBUG_CACHE))
 
 // During contructor, allocate the vector of ssa_names.
 
diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc
index 6946fa65dda..4e45c593871 100644
--- a/gcc/gimple-range-gori.cc
+++ b/gcc/gimple-range-gori.cc
@@ -644,7 +644,7 @@  gori_compute::gori_compute (int not_executable_flag)
   // Create a boolean_type true and false range.
   m_bool_zero = int_range<2> (boolean_false_node, boolean_false_node);
   m_bool_one = int_range<2> (boolean_true_node, boolean_true_node);
-  if (dump_file && (param_evrp_mode & EVRP_MODE_GORI))
+  if (dump_file && (param_ranger_debug & RANGER_DEBUG_GORI))
     tracer.enable_trace ();
 }
 
diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc
index 93d6da66ccb..69cde911c49 100644
--- a/gcc/gimple-range.cc
+++ b/gcc/gimple-range.cc
@@ -42,7 +42,7 @@  gimple_ranger::gimple_ranger () :
 {
   // If the cache has a relation oracle, use it.
   m_oracle = m_cache.oracle ();
-  if (dump_file && (param_evrp_mode & EVRP_MODE_TRACE))
+  if (dump_file && (param_ranger_debug & RANGER_DEBUG_TRACE))
     tracer.enable_trace ();
 
   // Ensure the not_executable flag is clear everywhere.
diff --git a/gcc/gimple-ssa-evrp.c b/gcc/gimple-ssa-evrp.c
index a0192e2b2aa..c3f84050c9e 100644
--- a/gcc/gimple-ssa-evrp.c
+++ b/gcc/gimple-ssa-evrp.c
@@ -300,7 +300,7 @@  hybrid_folder::choose_value (tree evrp_val, tree ranger_val)
     return evrp_val;
 
   // If values are different, return the first calculated value.
-  if ((param_evrp_mode & EVRP_MODE_RVRP_FIRST) == EVRP_MODE_RVRP_FIRST)
+  if (param_evrp_mode == EVRP_MODE_RVRP_FIRST)
     return ranger_val;
   return evrp_val;
 }
@@ -312,7 +312,7 @@  hybrid_folder::choose_value (tree evrp_val, tree ranger_val)
 static unsigned int
 execute_early_vrp ()
 {
-  if ((param_evrp_mode & EVRP_MODE_RVRP_FIRST) == EVRP_MODE_RVRP_ONLY)
+  if (param_evrp_mode == EVRP_MODE_RVRP_ONLY)
     return execute_ranger_vrp (cfun, false);
 
   /* Ideally this setup code would move into the ctor for the folder
@@ -325,7 +325,7 @@  execute_early_vrp ()
   calculate_dominance_info (CDI_DOMINATORS);
 
   // Only the last 2 bits matter for choosing the folder.
-  switch (param_evrp_mode & EVRP_MODE_RVRP_FIRST)
+  switch (param_evrp_mode)
     {
     case EVRP_MODE_EVRP_ONLY:
       {
diff --git a/gcc/params.opt b/gcc/params.opt
index 27ef4b6578f..393d52bc660 100644
--- a/gcc/params.opt
+++ b/gcc/params.opt
@@ -136,7 +136,7 @@  Maximum number of outgoing edges in a switch before EVRP will not process it.
 
 -param=evrp-mode=
 Common Joined Var(param_evrp_mode) Enum(evrp_mode) Init(EVRP_MODE_RVRP_ONLY) Param Optimization
---param=evrp-mode=[legacy|ranger|legacy-first|ranger-first|trace|gori|cache|tracegori|debug] Specifies the mode Early VRP should operate in.
+--param=evrp-mode=[legacy|ranger|legacy-first|ranger-first] Specifies the mode Early VRP should operate in.
 
 Enum
 Name(evrp_mode) Type(enum evrp_mode) UnknownError(unknown evrp mode %qs)
@@ -153,26 +153,6 @@  Enum(evrp_mode) String(legacy-first) Value(EVRP_MODE_EVRP_FIRST)
 EnumValue
 Enum(evrp_mode) String(ranger-first) Value(EVRP_MODE_RVRP_FIRST)
 
-EnumValue
-Enum(evrp_mode) String(trace) Value(EVRP_MODE_TRACE)
-
-EnumValue
-Enum(evrp_mode) String(cache) Value(EVRP_MODE_CACHE)
-
-EnumValue
-Enum(evrp_mode) String(gori) Value(EVRP_MODE_GORI)
-
-EnumValue
-Enum(evrp_mode) String(tracegori) Value(EVRP_MODE_TRACE_GORI)
-
-EnumValue
-Enum(evrp_mode) String(debug) Value(EVRP_MODE_DEBUG)
-
--param=ranger-logical-depth=
-Common Joined UInteger Var(param_ranger_logical_depth) Init(6) IntegerRange(1, 999) Param Optimization
-Maximum depth of logical expression evaluation ranger will look through when
-evaluating outgoing edge ranges.
-
 -param=fsm-scale-path-blocks=
 Common Joined UInteger Var(param_fsm_scale_path_blocks) Init(3) IntegerRange(1, 10) Param Optimization
 Scale factor to apply to the number of blocks in a threading path when comparing to the number of (scaled) statements.
@@ -893,6 +873,36 @@  The minimum constant stride beyond which we should use prefetch hints for.
 Common Joined UInteger Var(param_profile_func_internal_id) IntegerRange(0, 1) Param
 Use internal function id in profile lookup.
 
+-param=ranger-debug=
+Common Joined Var(param_ranger_debug) Enum(ranger_debug) Init(RANGER_DEBUG_NONE) Param Optimization
+--param=ranger-debug=[none|trace|gori|cache|tracegori|all] Specifies the output mode for debugging ranger.
+
+Enum
+Name(ranger_debug) Type(enum ranger_debug) UnknownError(unknown ranger debug mode %qs)
+
+EnumValue
+Enum(ranger_debug) String(none) Value(RANGER_DEBUG_NONE)
+
+EnumValue
+Enum(ranger_debug) String(trace) Value(RANGER_DEBUG_TRACE)
+
+EnumValue
+Enum(ranger_debug) String(cache) Value(RANGER_DEBUG_CACHE)
+
+EnumValue
+Enum(ranger_debug) String(gori) Value(RANGER_DEBUG_GORI)
+
+EnumValue
+Enum(ranger_debug) String(tracegori) Value(RANGER_DEBUG_TRACE_GORI)
+
+EnumValue
+Enum(ranger_debug) String(all) Value(RANGER_DEBUG_ALL)
+
+-param=ranger-logical-depth=
+Common Joined UInteger Var(param_ranger_logical_depth) Init(6) IntegerRange(1, 999) Param Optimization
+Maximum depth of logical expression evaluation ranger will look through when
+evaluating outgoing edge ranges.
+
 -param=rpo-vn-max-loop-depth=
 Common Joined UInteger Var(param_rpo_vn_max_loop_depth) Init(7) IntegerRange(2, 65536) Param Optimization
 Maximum depth of a loop nest to fully value-number optimistically.
-- 
2.17.2