* simplify-rtx.c (simplify_plus_minus): Do simplify constants.
authoramodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 1 Dec 2005 23:48:13 +0000 (23:48 +0000)
committeramodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 1 Dec 2005 23:48:13 +0000 (23:48 +0000)
Delete dead code.

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

gcc/ChangeLog
gcc/simplify-rtx.c

index 6d386e6..e40030a 100644 (file)
@@ -1,3 +1,8 @@
+2005-12-02  Alan Modra  <amodra@bigpond.net.au>
+
+       * simplify-rtx.c (simplify_plus_minus): Do simplify constants.
+       Delete dead code.
+
 2005-12-01  Richard Henderson  <rth@redhat.com>
 
        * optabs.c (expand_vec_cond_expr): Use EXPAND_NORMAL.
index bc17131..9b39f0d 100644 (file)
@@ -2602,7 +2602,7 @@ simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0,
 {
   struct simplify_plus_minus_op_data ops[8];
   rtx result, tem;
-  int n_ops = 2, input_ops = 2, input_consts = 0, n_consts;
+  int n_ops = 2, input_ops = 2;
   int first, changed, canonicalized = 0;
   int i, j;
 
@@ -2661,7 +2661,6 @@ simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0,
                  ops[n_ops].op = XEXP (XEXP (this_op, 0), 1);
                  ops[n_ops].neg = this_neg;
                  n_ops++;
-                 input_consts++;
                  changed = 1;
                  canonicalized = 1;
                }
@@ -2699,7 +2698,16 @@ simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0,
 
   gcc_assert (n_ops >= 2);
   if (!canonicalized)
-    return NULL_RTX;
+    {
+      int n_constants = 0;
+
+      for (i = 0; i < n_ops; i++)
+       if (GET_CODE (ops[i].op) == CONST_INT)
+         n_constants++;
+
+      if (n_constants <= 1)
+       return NULL_RTX;
+    }
 
   /* If we only have two operands, we can avoid the loops.  */
   if (n_ops == 2)
@@ -2728,11 +2736,6 @@ simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0,
       return simplify_const_binary_operation (code, mode, lhs, rhs);
     }
 
-  /* Count the number of CONSTs we didn't split above.  */
-  for (i = 0; i < n_ops; i++)
-    if (GET_CODE (ops[i].op) == CONST)
-      input_consts++;
-
   /* Now simplify each pair of operands until nothing changes.  The first
      time through just simplify constants against each other.  */
 
@@ -2835,12 +2838,6 @@ simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0,
       n_ops--;
     }
 
-  /* Count the number of CONSTs that we generated.  */
-  n_consts = 0;
-  for (i = 0; i < n_ops; i++)
-    if (GET_CODE (ops[i].op) == CONST)
-      n_consts++;
-
   /* Put a non-negated operand first, if possible.  */
 
   for (i = 0; i < n_ops && ops[i].neg; i++)