loop.c (simplify_giv_expr): Adding two invariants results in an invariant.
authorJeffrey A Law <law@cygnus.com>
Sun, 26 Oct 1997 16:20:07 +0000 (16:20 +0000)
committerJeff Law <law@gcc.gnu.org>
Sun, 26 Oct 1997 16:20:07 +0000 (09:20 -0700)
        * loop.c (simplify_giv_expr): Adding two invariants results
        in an invariant.

From-SVN: r16179

gcc/ChangeLog
gcc/loop.c

index 80d231e2f13ce5385f4be4dfb2860ff6c8cdc791..a1b6628ca77d7b100f75b2e04d7ee86359f2df09 100644 (file)
@@ -1,3 +1,8 @@
+Sun Oct 26 09:21:40 1997  Jeffrey A Law  (law@cygnus.com)
+
+       * loop.c (simplify_giv_expr): Adding two invariants results
+       in an invariant.
+
 Sun Oct 26 09:15:15 1997  Richard Henderson  <rth@cygnus.com>
 
        * expr.c (get_inner_reference): Remove the array bias after 
index 6bae48fec982dd6cad4c55d7285852ecd2a39cb1..73f347fd86f32e755cf06aed5dfbefb3f052f66a 100644 (file)
@@ -5353,10 +5353,13 @@ simplify_giv_expr (x, benefit)
          case CONST_INT:
          case USE:
            /* Both invariant.  Only valid if sum is machine operand.
-              First strip off possible USE on first operand.  */
+              First strip off possible USE on the operands.  */
            if (GET_CODE (arg0) == USE)
              arg0 = XEXP (arg0, 0);
 
+           if (GET_CODE (arg1) == USE)
+             arg1 = XEXP (arg1, 0);
+
            tem = 0;
            if (CONSTANT_P (arg0) && GET_CODE (arg1) == CONST_INT)
              {
@@ -5364,6 +5367,13 @@ simplify_giv_expr (x, benefit)
                if (GET_CODE (tem) != CONST_INT)
                  tem = gen_rtx (USE, mode, tem);
              }
+           else
+             {
+               /* Adding two invariants must result in an invariant,
+                  so enclose addition operation inside a USE and
+                  return it.  */
+               tem = gen_rtx (USE, mode, gen_rtx (PLUS, mode, arg0, arg1));
+             }
 
            return tem;