[GCC8,18/33] Relate compare iv_use with all candidates

Submitted by Bin Cheng on April 18, 2017, 10:46 a.m.

Details

Message ID VI1PR0802MB2176E02EDB145AB677A0A7F3E7190@VI1PR0802MB2176.eurprd08.prod.outlook.com
State New
Headers show

Commit Message

Bin Cheng April 18, 2017, 10:46 a.m.
Hi,
For compare type iv_use, we want to relate it with all candidates in order
to achieve smaller candidate set.  Generally this doesn't hurt compilation
time because compare iv_use is already related with most candidates and
the number of compare iv_uses is also small.
Is it OK?

Thanks,
bin
2017-04-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.
From 05d21bf9421fb312a3470eb232bf98cd16d072a6 Mon Sep 17 00:00:00 2001
From: Bin Cheng <binche01@e108451-lin.cambridge.arm.com>
Date: Thu, 6 Apr 2017 10:09:18 +0100
Subject: [PATCH 18/33] relate-comp_use-with-all-cands-20170312.txt

---
 gcc/tree-ssa-loop-ivopts.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Comments

Richard Guenther April 26, 2017, 1:12 p.m.
On Tue, Apr 18, 2017 at 12:46 PM, Bin Cheng <Bin.Cheng@arm.com> wrote:
> Hi,
> For compare type iv_use, we want to relate it with all candidates in order
> to achieve smaller candidate set.  Generally this doesn't hurt compilation
> time because compare iv_use is already related with most candidates and
> the number of compare iv_uses is also small.
> Is it OK?

Ok.

Richard.

> Thanks,
> bin
> 2017-04-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.

Patch hide | download patch | download mbox

diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 2c6fa76..0f78a46 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -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;