OSDN Git Service

* tree-ssa-loop-ivopts.c (get_address_cost): Offset zero does not
authoruweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Nov 2004 17:56:48 +0000 (17:56 +0000)
committeruweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Nov 2004 17:56:48 +0000 (17:56 +0000)
cause extra costs.  Generate canonical RTL.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@90030 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 0128360..accb133 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 58771cd..f457f7a 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);