re PR middle-end/45098 (Missed induction variable optimization)
authorTom de Vries <tom@codesourcery.com>
Thu, 19 May 2011 08:49:28 +0000 (08:49 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Thu, 19 May 2011 08:49:28 +0000 (08:49 +0000)
2011-05-19  Tom de Vries  <tom@codesourcery.com>

PR target/45098
* tree-ssa-loop-ivopts.c (determine_iv_cost): Prevent
cost_base.cost == 0.

From-SVN: r173893

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

index c695f9b7998723033a9bb43a2bf8de02beb4b642..a3ce4ef982d6749fa00f2c16e70df7902a4d1283 100644 (file)
@@ -1,3 +1,9 @@
+2011-05-19  Tom de Vries  <tom@codesourcery.com>
+
+       PR target/45098
+       * tree-ssa-loop-ivopts.c (determine_iv_cost): Prevent
+       cost_base.cost == 0.
+
 2011-05-18  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/49002
index 501dbbf45265b0d74b14db56472ed344c8bc7775..1580aec006a3945df657f1d0047d1d43ff089d5d 100644 (file)
@@ -4690,6 +4690,11 @@ determine_iv_cost (struct ivopts_data *data, struct iv_cand *cand)
 
   base = cand->iv->base;
   cost_base = force_var_cost (data, base, NULL);
+  /* It will be exceptional that the iv register happens to be initialized with
+     the proper value at no cost.  In general, there will at least be a regcopy
+     or a const set.  */
+  if (cost_base.cost == 0)
+    cost_base.cost = COSTS_N_INSNS (1);
   cost_step = add_cost (TYPE_MODE (TREE_TYPE (base)), data->speed);
 
   cost = cost_step + adjust_setup_cost (data, cost_base.cost);