[OBVIOUS] Handle boundary case for last iv candidate

Submitted by Bin Cheng on Aug. 8, 2017, 2:43 p.m.

Details

Message ID DB5PR0801MB2742AC9A61249D1C9EFA10BCE78A0@DB5PR0801MB2742.eurprd08.prod.outlook.com
State New
Headers show

Commit Message

Bin Cheng Aug. 8, 2017, 2:43 p.m.
Hi,
When investigate issues, I ran into this obvious issue that the last candidate is not related to compare type iv_use.
This patch fixes it.  Will apply later.

Thanks,
bin
2017-08-08  Bin Cheng  <bin.cheng@arm.com>

	* tree-ssa-loop-ivopts.c (relate_compare_use_with_all_cands): Handle
	boundary case for the last candidate.

Patch hide | download patch | download mbox

diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 1cbff04..b65cd96 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -5284,13 +5284,13 @@  set_autoinc_for_original_candidates (struct ivopts_data *data)
 static void
 relate_compare_use_with_all_cands (struct ivopts_data *data)
 {
-  unsigned i, max_id = data->vcands.length () - 1;
+  unsigned i, count = data->vcands.length ();
   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);
+	bitmap_set_range (group->related_cands, 0, count);
     }
 }