aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop.c
diff options
context:
space:
mode:
authorJeffrey A Law <law@cygnus.com>1997-10-26 16:20:07 +0000
committerJeff Law <law@gcc.gnu.org>1997-10-26 09:20:07 -0700
commitda0af5a56fc0b83f9c7f7eaa4038a4a627f4cfbc (patch)
treecd9b5f643030d75564498fa835a6ecbfa4ee9281 /gcc/loop.c
parentca0f22208fdcfd30565f0163fdeab273af69456b (diff)
downloadgcc-da0af5a56fc0b83f9c7f7eaa4038a4a627f4cfbc.zip
gcc-da0af5a56fc0b83f9c7f7eaa4038a4a627f4cfbc.tar.gz
gcc-da0af5a56fc0b83f9c7f7eaa4038a4a627f4cfbc.tar.bz2
loop.c (simplify_giv_expr): Adding two invariants results in an invariant.
* loop.c (simplify_giv_expr): Adding two invariants results in an invariant. From-SVN: r16179
Diffstat (limited to 'gcc/loop.c')
-rw-r--r--gcc/loop.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/loop.c b/gcc/loop.c
index 6bae48f..73f347f 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -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;