tree-ssa-loop-ivopts.c (relate_compare_use_with_all_cands): New.
authorBin Cheng <bin.cheng@arm.com>
Thu, 11 May 2017 09:42:36 +0000 (09:42 +0000)
committerBin Cheng <amker@gcc.gnu.org>
Thu, 11 May 2017 09:42:36 +0000 (09:42 +0000)
* tree-ssa-loop-ivopts.c (relate_compare_use_with_all_cands): New.
(find_iv_candidates): Call relate_compare_use_with_all_cands.

From-SVN: r247890

gcc/ChangeLog
gcc/tree-ssa-loop-ivopts.c

index ea4912bfa1b8b022fc7398ccb898b58ed2d290d6..95d560c67466aa26fca22704f4baa6e2725c8e45 100644 (file)
@@ -1,3 +1,8 @@
+2017-05-11  Bin Cheng  <bin.cheng@arm.com>
+
+       * tree-ssa-loop-ivopts.c (relate_compare_use_with_all_cands): New.
+       (find_iv_candidates): Call relate_compare_use_with_all_cands.
+
 2017-05-11  Bin Cheng  <bin.cheng@arm.com>
 
        * tree-ssa-loop-ivopts.c (struct iv_cand): New field inv_exprs.
index 5d7391631d643fbae95aa12fc0dbecdf49ed7ac5..d0757c3c5b28cf74ee200548d18a323b44346fb1 100644 (file)
@@ -5250,6 +5250,21 @@ set_autoinc_for_original_candidates (struct ivopts_data *data)
     }
 }
 
+/* Relate compare use with all candidates.  */
+
+static void
+relate_compare_use_with_all_cands (struct ivopts_data *data)
+{
+  unsigned i, max_id = data->vcands.length () - 1;
+  for (i = 0; i < data->vgroups.length (); i++)
+    {
+      struct iv_group *group = data->vgroups[i];
+
+      if (group->type == USE_COMPARE)
+       bitmap_set_range (group->related_cands, 0, max_id);
+    }
+}
+
 /* Finds the candidates for the induction variables.  */
 
 static void
@@ -5269,6 +5284,10 @@ find_iv_candidates (struct ivopts_data *data)
   /* Record the important candidates.  */
   record_important_candidates (data);
 
+  /* Relate compare iv_use with all candidates.  */
+  if (!data->consider_all_candidates)
+    relate_compare_use_with_all_cands (data);
+
   if (dump_file && (dump_flags & TDF_DETAILS))
     {
       unsigned i;