I found a weird piece of code that was added by kenner in a really early
revision. It checks for VAR_DECLs with frame or stack pointers as
DECL_RTL, and the comment in front of it mentions strength reduction.
Presumably this was for the old loop optimizer? I can't think of
anything that would require this in a modern version of gcc.

Bootstrapped and tested on i686-linux; no changes in code generation on
any of my test files. Ok?


Bernd
        * expr.c (expand_expr_real_2) [PLUS_EXPR]: Delete code dealing with
        VAR_DECLs of frame or stack pointers.

Index: gcc/expr.c
===================================================================
--- gcc/expr.c  (revision 184790)
+++ gcc/expr.c  (working copy)
@@ -8040,30 +8040,6 @@ expand_expr_real_2 (sepops ops, rtx targ
                                    fold_convert_loc (loc, ssizetype,
                                                      treeop1));
     case PLUS_EXPR:
-      /* If we are adding a constant, a VAR_DECL that is sp, fp, or ap, and
-        something else, make sure we add the register to the constant and
-        then to the other thing.  This case can occur during strength
-        reduction and doing it this way will produce better code if the
-        frame pointer or argument pointer is eliminated.
-
-        fold-const.c will ensure that the constant is always in the inner
-        PLUS_EXPR, so the only case we need to do anything about is if
-        sp, ap, or fp is our second argument, in which case we must swap
-        the innermost first argument and our second argument.  */
-
-      if (TREE_CODE (treeop0) == PLUS_EXPR
-         && TREE_CODE (TREE_OPERAND (treeop0, 1)) == INTEGER_CST
-         && TREE_CODE (treeop1) == VAR_DECL
-         && (DECL_RTL (treeop1) == frame_pointer_rtx
-             || DECL_RTL (treeop1) == stack_pointer_rtx
-             || DECL_RTL (treeop1) == arg_pointer_rtx))
-       {
-         tree t = treeop1;
-
-         treeop1 = TREE_OPERAND (treeop0, 0);
-         TREE_OPERAND (treeop0, 0) = t;
-       }
-
       /* If the result is to be ptr_mode and we are adding an integer to
         something, we might be forming a constant.  So try to use
         plus_constant.  If it produces a sum and we can't accept it,

Reply via email to