public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aldyh/heads/ranger-staging)] Add rvrp-debug mode. adjust outgoing_range_stmt_p
@ 2020-08-31 15:39 Andrew Macleod
  0 siblings, 0 replies; only message in thread
From: Andrew Macleod @ 2020-08-31 15:39 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0546b8534cb5c5bf2a3133b8897ffd6f02b6735c

commit 0546b8534cb5c5bf2a3133b8897ffd6f02b6735c
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Mon Aug 31 11:22:03 2020 -0400

    Add rvrp-debug  mode.    adjust outgoing_range_stmt_p

Diff:
---
 gcc/common.opt            | 5 ++++-
 gcc/flag-types.h          | 3 ++-
 gcc/gimple-range-cache.cc | 2 +-
 gcc/gimple-range-edge.cc  | 5 ++++-
 gcc/gimple-range-trace.h  | 2 +-
 gcc/gimple-ssa-evrp.c     | 4 +++-
 6 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/gcc/common.opt b/gcc/common.opt
index 5fc2fc2a2a8..98556c31ab3 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -2868,7 +2868,7 @@ Perform Value Range Propagation on trees.
 
 fevrp-mode=
 Common Joined RejectNegative Enum(evrp_mode) Var(flag_evrp_mode) Init(EVRP_MODE_EVRP_FIRST) Optimization
--fevrp-mode=[evrp-only|rvrp-only|evrp-first|rvrp-first|rvrp-trace] Specifies the mode Early VRP should operate in.
+-fevrp-mode=[evrp-only|rvrp-only|evrp-first|rvrp-first|rvrp-trace|rvrp-debug] Specifies the mode Early VRP should operate in.
 
 Enum
 Name(evrp_mode) Type(enum evrp_mode) UnknownError(unknown evrp mode %qs)
@@ -2888,6 +2888,9 @@ Enum(evrp_mode) String(rvrp-first) Value(EVRP_MODE_RVRP_FIRST)
 EnumValue
 Enum(evrp_mode) String(rvrp-trace) Value(EVRP_MODE_RVRP_TRACE)
 
+EnumValue
+Enum(evrp_mode) String(rvrp-debug) Value(EVRP_MODE_RVRP_DEBUG)
+
 fsplit-paths
 Common Report Var(flag_split_paths) Init(0) Optimization
 Split paths leading to loop backedges.
diff --git a/gcc/flag-types.h b/gcc/flag-types.h
index 0f4d3c5683a..7290f0586cd 100644
--- a/gcc/flag-types.h
+++ b/gcc/flag-types.h
@@ -389,7 +389,8 @@ enum evrp_mode
   EVRP_MODE_RVRP_ONLY,
   EVRP_MODE_EVRP_FIRST,
   EVRP_MODE_RVRP_FIRST,
-  EVRP_MODE_RVRP_TRACE
+  EVRP_MODE_RVRP_TRACE,
+  EVRP_MODE_RVRP_DEBUG
 };
 
 #endif /* ! GCC_FLAG_TYPES_H */
diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc
index 23eb9e7ce8f..22536ee7d7d 100644
--- a/gcc/gimple-range-cache.cc
+++ b/gcc/gimple-range-cache.cc
@@ -535,7 +535,7 @@ ranger_cache::add_to_update (basic_block bb)
     m_update_list.quick_push (bb);
 }
 
-#define DEBUG_CACHE (0 && dump_file)
+#define DEBUG_CACHE (dump_file && flag_evrp_mode == EVRP_MODE_RVRP_DEBUG)
 
 // If there is anything in the iterative update_list, continue
 // processing NAME until the list of blocks is empty.
diff --git a/gcc/gimple-range-edge.cc b/gcc/gimple-range-edge.cc
index 9d1d4ed8f41..3e10a3a2f65 100644
--- a/gcc/gimple-range-edge.cc
+++ b/gcc/gimple-range-edge.cc
@@ -144,7 +144,10 @@ gimple *
 gimple_outgoing_range_stmt_p (basic_block bb)
 {
   // This will return NULL if there is not a branch statement.
-  return gsi_stmt (gsi_outgoing_range_stmt (bb));
+  gimple *stmt = gsi_stmt (gsi_outgoing_range_stmt (bb));
+  if (stmt && gimple_range_handler (stmt))
+    return stmt;
+  return NULL;
 }
 
 // Calculate the range forced on on edge E by control flow, return it
diff --git a/gcc/gimple-range-trace.h b/gcc/gimple-range-trace.h
index e6987fbd103..af70771f754 100644
--- a/gcc/gimple-range-trace.h
+++ b/gcc/gimple-range-trace.h
@@ -182,6 +182,6 @@ trace_ranger::range_of_expr (irange &r, tree name, gimple *s)
 
   res = gimple_ranger::range_of_expr (r, name, s);
 
-  return trailer (idx, "range_of_stmt", res, name, r);
+  return trailer (idx, "range_of_expr", res, name, r);
 }
 
diff --git a/gcc/gimple-ssa-evrp.c b/gcc/gimple-ssa-evrp.c
index e2fb3d595e4..cfebeb3bce8 100644
--- a/gcc/gimple-ssa-evrp.c
+++ b/gcc/gimple-ssa-evrp.c
@@ -145,7 +145,8 @@ public:
 
   rvrp_folder () : substitute_and_fold_engine (), m_simplifier ()
   { 
-    if (flag_evrp_mode == EVRP_MODE_RVRP_TRACE)
+    if (flag_evrp_mode == EVRP_MODE_RVRP_TRACE
+	|| flag_evrp_mode == EVRP_MODE_RVRP_DEBUG)
       m_ranger = new trace_ranger (true);
     else
       m_ranger = new gimple_ranger (true);
@@ -335,6 +336,7 @@ execute_early_vrp ()
       }
     case EVRP_MODE_RVRP_ONLY:
     case EVRP_MODE_RVRP_TRACE:
+    case EVRP_MODE_RVRP_DEBUG:
       {
 	rvrp_folder folder;
 	folder.substitute_and_fold ();


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

only message in thread, other threads:[~2020-08-31 15:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-31 15:39 [gcc(refs/users/aldyh/heads/ranger-staging)] Add rvrp-debug mode. adjust outgoing_range_stmt_p Andrew Macleod

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