OSDN Git Service

* gcc.dg/20040910-1.c, gcc.dg/cpp/digraph2.c,
[pf3gnuchains/gcc-fork.git] / gcc / tree-ssa-loop-ivopts.c
index 58771cd..ce1eccc 100644 (file)
@@ -2485,7 +2485,8 @@ get_address_cost (bool symbol_present, bool var_present,
   s_offset = offset;
 
   cost = 0;
-  offset_p = (min_offset <= s_offset && s_offset <= max_offset);
+  offset_p = (s_offset != 0
+             && min_offset <= s_offset && s_offset <= max_offset);
   ratio_p = (ratio != 1
             && -MAX_RATIO <= ratio && ratio <= MAX_RATIO
             && TEST_BIT (valid_mult, ratio + MAX_RATIO));
@@ -2509,6 +2510,9 @@ get_address_cost (bool symbol_present, bool var_present,
       if (ratio_p)
        addr = gen_rtx_fmt_ee (MULT, Pmode, addr, GEN_INT (rat));
 
+      if (var_present)
+       addr = gen_rtx_fmt_ee (PLUS, Pmode, reg1, addr);
+
       if (symbol_present)
        {
          base = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (""));
@@ -2517,15 +2521,6 @@ get_address_cost (bool symbol_present, bool var_present,
                                  gen_rtx_fmt_ee (PLUS, Pmode,
                                                  base,
                                                  GEN_INT (off)));
-         if (var_present)
-           base = gen_rtx_fmt_ee (PLUS, Pmode, reg1, base);
-       }
-
-      else if (var_present)
-       {
-         base = reg1;
-         if (offset_p)
-           base = gen_rtx_fmt_ee (PLUS, Pmode, base, GEN_INT (off));
        }
       else if (offset_p)
        base = GEN_INT (off);
@@ -3478,8 +3473,8 @@ find_best_candidate (struct ivopts_data *data,
     {
       asol = BITMAP_XMALLOC ();
 
-      bitmap_a_or_b (asol, data->important_candidates, use->related_cands);
-      bitmap_a_and_b (asol, asol, sol);
+      bitmap_ior (asol, data->important_candidates, use->related_cands);
+      bitmap_and_into (asol, sol);
     }
 
   EXECUTE_IF_SET_IN_BITMAP (asol, 0, c, bi)
@@ -3505,7 +3500,7 @@ find_best_candidate (struct ivopts_data *data,
              goto next_cand;
            }
          if (used_inv)
-           bitmap_a_or_b (used_inv, used_inv, depends_on);
+           bitmap_ior_into (used_inv, depends_on);
        }
 
       cnd = acnd;
@@ -3628,7 +3623,7 @@ try_add_cand_for (struct ivopts_data *data, bitmap ivs, bitmap inv,
       bitmap_copy (act_ivs, ivs);
       bitmap_set_bit (act_ivs, cand->id);
       if (depends_on)
-       bitmap_a_or_b (act_inv, inv, depends_on);
+       bitmap_ior (act_inv, inv, depends_on);
       else
        bitmap_copy (act_inv, inv);
       act_cost = set_cost_up_to (data, act_ivs, act_inv, use->id + 1);
@@ -3656,7 +3651,7 @@ try_add_cand_for (struct ivopts_data *data, bitmap ivs, bitmap inv,
          bitmap_copy (act_ivs, ivs);
          bitmap_set_bit (act_ivs, cp->cand->id);
          if (cp->depends_on)
-           bitmap_a_or_b (act_inv, inv, cp->depends_on);
+           bitmap_ior (act_inv, inv, cp->depends_on);
          else
            bitmap_copy (act_inv, inv);
          act_cost = set_cost_up_to (data, act_ivs, act_inv, use->id + 1);