From 06fd3160aabe468b22ad66c994140ff6cb0ff0d4 Mon Sep 17 00:00:00 2001 From: Bin Cheng Date: Thu, 11 May 2017 09:42:36 +0000 Subject: [PATCH] tree-ssa-loop-ivopts.c (relate_compare_use_with_all_cands): New. * 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 | 5 +++++ gcc/tree-ssa-loop-ivopts.c | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ea4912bfa1b..95d560c6746 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-05-11 Bin Cheng + + * 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 * tree-ssa-loop-ivopts.c (struct iv_cand): New field inv_exprs. diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 5d7391631d6..d0757c3c5b2 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; -- 2.30.2