diff mbox

[gimple-classes,committed,17/92] Concretize get_loop_exit_condition et al to working on gimple_cond

Message ID 1414442490-14841-18-git-send-email-dmalcolm@redhat.com
State New
Headers show

Commit Message

David Malcolm Oct. 27, 2014, 8:40 p.m. UTC
This corresponds to:
  [PATCH 18/89] Concretize get_loop_exit_condition et al to working on gimple_cond
  https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01215.html
from the original 89-patch kit

That earlier patch was approved by Jeff:
> OK when prerequisites have gone in.
> Actually that's true for #17 & #18 as well.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00626.html

gcc/
	* tree-scalar-evolution.h (get_loop_exit_condition): Return a
	gimple_cond.
	* tree-scalar-evolution.c (get_loop_exit_condition): Likewise, also
	concretizing local "res" from gimple to gimple_cond.
	* tree-vect-loop-manip.c (slpeel_make_loop_iterate_ntimes): Convert
	locals from gimple to gimple_cond.
	(slpeel_can_duplicate_loop_p): Likewise.
	* tree-vect-loop.c (vect_get_loop_niters): Return a gimple_cond.
	(vect_analyze_loop_form): Convert local from gimple to gimple_cond.
---
 gcc/ChangeLog.gimple-classes | 14 ++++++++++++++
 gcc/tree-scalar-evolution.c  |  8 ++++----
 gcc/tree-scalar-evolution.h  |  2 +-
 gcc/tree-vect-loop-manip.c   |  6 +++---
 gcc/tree-vect-loop.c         |  5 +++--
 5 files changed, 25 insertions(+), 10 deletions(-)
diff mbox

Patch

diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index c28facc..627e6a2 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,19 @@ 
 2014-10-24  David Malcolm  <dmalcolm@redhat.com>
 
+	Concretize get_loop_exit_condition et al to working on gimple_cond
+
+	* tree-scalar-evolution.h (get_loop_exit_condition): Return a
+	gimple_cond.
+	* tree-scalar-evolution.c (get_loop_exit_condition): Likewise, also
+	concretizing local "res" from gimple to gimple_cond.
+	* tree-vect-loop-manip.c (slpeel_make_loop_iterate_ntimes): Convert
+	locals from gimple to gimple_cond.
+	(slpeel_can_duplicate_loop_p): Likewise.
+	* tree-vect-loop.c (vect_get_loop_niters): Return a gimple_cond.
+	(vect_analyze_loop_form): Convert local from gimple to gimple_cond.
+
+2014-10-24  David Malcolm  <dmalcolm@redhat.com>
+
 	Update various expressions within tree-scalar-evolution.c to be gimple_phi
 
 	* tree-scalar-evolution.c (follow_ssa_edge): Require a gimple_phi,
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index 7ffa241..cff820f 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -867,10 +867,10 @@  add_to_evolution (unsigned loop_nb, tree chrec_before, enum tree_code code,
    guards the exit edge.  If the expression is too difficult to
    analyze, then give up.  */
 
-gimple
+gimple_cond
 get_loop_exit_condition (const struct loop *loop)
 {
-  gimple res = NULL;
+  gimple_cond res = NULL;
   edge exit_edge = single_exit (loop);
 
   if (dump_file && (dump_flags & TDF_SCEV))
@@ -881,8 +881,8 @@  get_loop_exit_condition (const struct loop *loop)
       gimple stmt;
 
       stmt = last_stmt (exit_edge->src);
-      if (gimple_code (stmt) == GIMPLE_COND)
-	res = stmt;
+      if (gimple_cond cond_stmt = dyn_cast <gimple_cond> (stmt))
+	res = cond_stmt;
     }
 
   if (dump_file && (dump_flags & TDF_SCEV))
diff --git a/gcc/tree-scalar-evolution.h b/gcc/tree-scalar-evolution.h
index 5569976..3466a75 100644
--- a/gcc/tree-scalar-evolution.h
+++ b/gcc/tree-scalar-evolution.h
@@ -22,7 +22,7 @@  along with GCC; see the file COPYING3.  If not see
 #define GCC_TREE_SCALAR_EVOLUTION_H
 
 extern tree number_of_latch_executions (struct loop *);
-extern gimple get_loop_exit_condition (const struct loop *);
+extern gimple_cond get_loop_exit_condition (const struct loop *);
 
 extern void scev_initialize (void);
 extern bool scev_initialized_p (void);
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index 46e18fe..fd60ea1 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -667,8 +667,8 @@  void
 slpeel_make_loop_iterate_ntimes (struct loop *loop, tree niters)
 {
   tree indx_before_incr, indx_after_incr;
-  gimple cond_stmt;
-  gimple orig_cond;
+  gimple_cond cond_stmt;
+  gimple_cond orig_cond;
   edge exit_edge = single_exit (loop);
   gimple_stmt_iterator loop_cond_gsi;
   gimple_stmt_iterator incr_gsi;
@@ -974,7 +974,7 @@  slpeel_can_duplicate_loop_p (const struct loop *loop, const_edge e)
 {
   edge exit_e = single_exit (loop);
   edge entry_e = loop_preheader_edge (loop);
-  gimple orig_cond = get_loop_exit_condition (loop);
+  gimple_cond orig_cond = get_loop_exit_condition (loop);
   gimple_stmt_iterator loop_exit_gsi = gsi_last_bb (exit_e->src);
 
   if (loop->inner
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 5e56d1b..560143e 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -805,7 +805,8 @@  vect_analyze_scalar_cycles (loop_vec_info loop_vinfo)
 
    Return the loop exit condition.  */
 
-static gimple
+
+static gimple_cond
 vect_get_loop_niters (struct loop *loop, tree *number_of_iterations,
 		      tree *number_of_iterationsm1)
 {
@@ -1085,7 +1086,7 @@  loop_vec_info
 vect_analyze_loop_form (struct loop *loop)
 {
   loop_vec_info loop_vinfo;
-  gimple loop_cond;
+  gimple_cond loop_cond;
   tree number_of_iterations = NULL, number_of_iterationsm1 = NULL;
   loop_vec_info inner_loop_vinfo = NULL;