combine.c (combine_validate_cost): Consider cost of undobuf.other_insn rather than...
authorIan Lance Taylor <ian@wasabisystems.com>
Wed, 15 Dec 2004 01:02:55 +0000 (01:02 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 15 Dec 2004 01:02:55 +0000 (01:02 +0000)
* combine.c (combine_validate_cost): Consider cost of
undobuf.other_insn rather than always allowing the recombination
if it is set.

From-SVN: r92173

gcc/ChangeLog
gcc/combine.c

index bb38fc880084c86c9a0cfeb075fd9c388fb7c305..a6a46452f3dfe3304947559570f02810d633b6ae 100644 (file)
@@ -1,3 +1,9 @@
+2004-12-14  Ian Lance Taylor  <ian@wasabisystems.com>
+
+       * combine.c (combine_validate_cost): Consider cost of
+       undobuf.other_insn rather than always allowing the recombination
+       if it is set.
+
 2004-12-14  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
 
        * pa-host.c (MAP_FAILED): Define if not defined.
index 181a33e7590a1030117a202ae273a03e245e55dd..800e65ea1006b6c4ad4ea5db3a8872a57d841d8a 100644 (file)
@@ -560,10 +560,25 @@ combine_validate_cost (rtx i1, rtx i2, rtx i3, rtx newpat, rtx newi2pat)
       new_i2_cost = 0;
     }
 
+  if (undobuf.other_insn)
+    {
+      int old_other_cost, new_other_cost;
+
+      old_other_cost = (INSN_UID (undobuf.other_insn) <= last_insn_cost
+                       ? uid_insn_cost[INSN_UID (undobuf.other_insn)] : 0);
+      new_other_cost = insn_rtx_cost (PATTERN (undobuf.other_insn));
+      if (old_other_cost > 0 && new_other_cost > 0)
+       {
+         old_cost += old_other_cost;
+         new_cost += new_other_cost;
+       }
+      else
+       old_cost = 0;
+    }
+
   /* Disallow this recombination if both new_cost and old_cost are
      greater than zero, and new_cost is greater than old cost.  */
-  if (!undobuf.other_insn
-      && old_cost > 0
+  if (old_cost > 0
       && new_cost > old_cost)
     {
       if (dump_file)