[gcc/devel/ranger] Fix bug where evrp was trapping on identical original and modified statements.

Aldy Hernandez aldyh@gcc.gnu.org
Thu Jun 11 07:21:03 GMT 2020


https://gcc.gnu.org/g:1957047ed1c94bf17cf993a2b1866965f493ba87

commit 1957047ed1c94bf17cf993a2b1866965f493ba87
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Thu Jun 11 08:43:02 2020 +0200

    Fix bug where evrp was trapping on identical original and modified statements.

Diff:
---
 gcc/misc.cc | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/gcc/misc.cc b/gcc/misc.cc
index 6c6688b2f11..5b056423600 100644
--- a/gcc/misc.cc
+++ b/gcc/misc.cc
@@ -75,8 +75,9 @@ class highlighter highlighter;
 void
 highlighter::on (pretty_printer *buffer, int spc, gimple *stmt)
 {
-  bool need_header = new_stmt == stmt || untainted_stmt == stmt;
   bool removal = untainted_stmt == stmt;
+  bool found_orig_stmt = new_stmt == stmt;
+  bool need_header = found_orig_stmt || removal;
   if (need_header)
     {
       pp_string (buffer, ";; (STATE) filename = ");
@@ -84,16 +85,16 @@ highlighter::on (pretty_printer *buffer, int spc, gimple *stmt)
       pp_newline_and_flush (buffer);
       INDENT (spc);
     }
-  if (new_stmt == stmt)
-    {
-      pp_string (buffer, ";; Original statement was: ");
-      pp_gimple_stmt_1 (buffer, old_stmt, spc, TDF_SLIM);
-    }
-  else if (removal)
+  if (removal)
     {
       pp_string (buffer, ";; Queued for removal LHS= ");
       dump_generic_node (buffer, lhs, spc, TDF_SLIM, false);
     }
+  else if (found_orig_stmt)
+    {
+      pp_string (buffer, ";; Original statement was: ");
+      pp_gimple_stmt_1 (buffer, old_stmt, spc, TDF_SLIM);
+    }
   if (need_header)
     {
       pp_newline_and_flush (buffer);
@@ -113,7 +114,9 @@ highlighter::on (pretty_printer *buffer, int spc, gimple *stmt)
 void
 highlighter::off (pretty_printer *buffer, int spc, gimple *stmt)
 {
-  if (new_stmt == stmt || untainted_stmt == stmt)
+  bool removal = untainted_stmt == stmt;
+  bool found_orig_stmt = new_stmt == stmt;
+  if (found_orig_stmt || removal)
     {
       pp_newline_and_flush (buffer);
       INDENT (spc);


More information about the Gcc-cvs mailing list