public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-5688] Also pre-process PHIs in range-of-stmt.
@ 2021-12-01 14:15 Andrew Macleod
  0 siblings, 0 replies; only message in thread
From: Andrew Macleod @ 2021-12-01 14:15 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:cb137e85720654e41db370d952df226654e576a6

commit r12-5688-gcb137e85720654e41db370d952df226654e576a6
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Mon Nov 29 12:00:26 2021 -0500

    Also pre-process PHIs in range-of-stmt.
    
            PR tree-optimization/103464
            * gimple-range.cc (gimple_ranger::prefill_name): Process phis also.
            (gimple_ranger::prefill_stmt_dependencies): Ditto.

Diff:
---
 gcc/gimple-range.cc | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc
index 178a470a419..c8431a7180b 100644
--- a/gcc/gimple-range.cc
+++ b/gcc/gimple-range.cc
@@ -333,7 +333,7 @@ gimple_ranger::prefill_name (irange &r, tree name)
   if (!gimple_range_ssa_p (name))
     return;
   gimple *stmt = SSA_NAME_DEF_STMT (name);
-  if (!gimple_range_handler (stmt))
+  if (!gimple_range_handler (stmt) && !is_a<gphi *> (stmt))
     return;
 
   bool current;
@@ -356,8 +356,8 @@ gimple_ranger::prefill_stmt_dependencies (tree ssa)
   gimple *stmt = SSA_NAME_DEF_STMT (ssa);
   gcc_checking_assert (stmt && gimple_bb (stmt));
 
-  // Only pre-process range-ops.
-  if (!gimple_range_handler (stmt))
+  // Only pre-process range-ops and phis.
+  if (!gimple_range_handler (stmt) && !is_a<gphi *> (stmt))
     return;
 
   // Mark where on the stack we are starting.
@@ -401,13 +401,22 @@ gimple_ranger::prefill_stmt_dependencies (tree ssa)
 	  print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
 	}
 
-      gcc_checking_assert (gimple_range_handler (stmt));
-      tree op = gimple_range_operand2 (stmt);
-      if (op)
-	prefill_name (r, op);
-      op = gimple_range_operand1 (stmt);
-      if (op)
-	prefill_name (r, op);
+      gphi *phi = dyn_cast <gphi *> (stmt);
+      if (phi)
+	{
+	  for (unsigned x = 0; x < gimple_phi_num_args (phi); x++)
+	    prefill_name (r, gimple_phi_arg_def (phi, x));
+	}
+      else
+	{
+	  gcc_checking_assert (gimple_range_handler (stmt));
+	  tree op = gimple_range_operand2 (stmt);
+	  if (op)
+	    prefill_name (r, op);
+	  op = gimple_range_operand1 (stmt);
+	  if (op)
+	    prefill_name (r, op);
+	}
     }
   if (idx)
     tracer.trailer (idx, "ROS ", false, ssa, r);


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

only message in thread, other threads:[~2021-12-01 14:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-01 14:15 [gcc r12-5688] Also pre-process PHIs in range-of-stmt 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).