cse.c (fold_rtx): Calculate the old cost before we fold each operand.
authorRichard Earnshaw <rearnsha@arm.com>
Sat, 21 Sep 2002 17:08:16 +0000 (17:08 +0000)
committerRichard Earnshaw <rearnsha@gcc.gnu.org>
Sat, 21 Sep 2002 17:08:16 +0000 (17:08 +0000)
* cse.c (fold_rtx): Calculate the old cost before we fold each
operand.

From-SVN: r57394

gcc/ChangeLog
gcc/cse.c

index 18404fff23e55f7b70682aa4b6410ccddaf0bc41..6b28a903227423cb6e8bb1b270acbf79ea4cdb2a 100644 (file)
@@ -1,3 +1,8 @@
+2002-09-21  Richard Earnshaw  <rearnsha@arm.com>
+
+       * cse.c (fold_rtx): Calculate the old cost before we fold each
+       operand.
+
 2002-09-21  Richard Henderson  <rth@redhat.com>
 
        * c-common.c (cpp_define_data_format): Remove __GCC_LITTLE_ENDIAN__,
index 3571cc7c730a4f447a260f295c20088680efca1d..e1b2ea1fbfea2b9be0978fbfefa9980d44018f3c 100644 (file)
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -3732,6 +3732,7 @@ fold_rtx (x, insn)
        rtx cheap_arg, expensive_arg;
        rtx replacements[2];
        int j;
+       int old_cost = COST_IN (XEXP (x, i), code);
 
        /* Most arguments are cheap, so handle them specially.  */
        switch (GET_CODE (arg))
@@ -3822,7 +3823,6 @@ fold_rtx (x, insn)
 
        for (j = 0; j < 2 && replacements[j]; j++)
          {
-           int old_cost = COST_IN (XEXP (x, i), code);
            int new_cost = COST_IN (replacements[j], code);
 
            /* Stop if what existed before was cheaper.  Prefer constants