]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-ssa-loop-ivopts.c (get_address_cost): Offset zero does not cause extra costs.
authorUlrich Weigand <uweigand@de.ibm.com>
Wed, 3 Nov 2004 17:56:48 +0000 (17:56 +0000)
committerUlrich Weigand <uweigand@gcc.gnu.org>
Wed, 3 Nov 2004 17:56:48 +0000 (17:56 +0000)
* tree-ssa-loop-ivopts.c (get_address_cost): Offset zero does not
cause extra costs.  Generate canonical RTL.

From-SVN: r90030

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

index 012836072e3223c6a6901efbe2458cb0b6084ef7..accb1339d92bd1219b4bb154652d6bda75374417 100644 (file)
@@ -1,3 +1,8 @@
+2004-11-03  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * tree-ssa-loop-ivopts.c (get_address_cost): Offset zero does not
+       cause extra costs.  Generate canonical RTL.
+
 2004-11-02  Daniel Berlin  <dberlin@dberlin.org>
 
        * lambda-code.c (lambda_compute_auxillary_space): Update comments.
index 58771cd6c4d1d0bf69af1b7b599381abbedd0d68..f457f7adf27dc8daee28ca97501741eb5cc8901c 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);