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.ch...@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 <binch...@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(+)
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;
--
1.9.1