tree-sra.c (sra_walk_fns): Document new restriction.
authorEric Botcazou <ebotcazou@gcc.gnu.org>
Fri, 2 Mar 2007 22:30:32 +0000 (22:30 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Fri, 2 Mar 2007 22:30:32 +0000 (22:30 +0000)
* tree-sra.c (sra_walk_fns) <ldst>: Document new restriction.
(sra_walk_modify_expr) <rhs_elt>: Treat the reference as a use
if the lhs has side-effects.
<lhs_elt>: Treat the reference as a use if the rhs has side-effects.

From-SVN: r122492

gcc/ChangeLog
gcc/tree-sra.c

index 39f849a3522e9353786a0c04f30115300d2ffe4a..5e8d89a456feefaa31fa7b9168627d2f47e9aad7 100644 (file)
@@ -1,3 +1,10 @@
+2007-03-02  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * tree-sra.c (sra_walk_fns) <ldst>: Document new restriction.
+       (sra_walk_modify_expr) <rhs_elt>: Treat the reference as a use
+       if the lhs has side-effects.
+       <lhs_elt>: Treat the reference as a use if the rhs has side-effects.
+
 2007-03-02  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/i386/i386.h (TUNEMASK): Remove define.
@@ -7,7 +14,7 @@
        * config/i386/i386.c (override_options): Ditto.
        (standard_80387_constant_p): Ditto.
 
-2007-03-03  Ian Lance Taylor  <iant@google.com>
+2007-03-02  Ian Lance Taylor  <iant@google.com>
 
        Used signed infinities in VRP.
        * tree-vrp.c (uses_overflow_infinity): New static function.
index cb8f63d18338a7e9ba441b21ab1783ab4ee38b99..ef7707f8b0ddb03116d4b0db8f4b51638a8ab42e 100644 (file)
@@ -685,8 +685,8 @@ struct sra_walk_fns
   void (*init) (struct sra_elt *elt, tree value, block_stmt_iterator *bsi);
 
   /* Invoked when we have a copy between one scalarizable reference ELT
-     and one non-scalarizable reference OTHER.  IS_OUTPUT is true if ELT
-     is on the left-hand side.  */
+     and one non-scalarizable reference OTHER without side-effects. 
+     IS_OUTPUT is true if ELT is on the left-hand side.  */
   void (*ldst) (struct sra_elt *elt, tree other,
                block_stmt_iterator *bsi, bool is_output);
 
@@ -908,7 +908,7 @@ sra_walk_gimple_modify_stmt (tree expr, block_stmt_iterator *bsi,
   /* If the RHS is scalarizable, handle it.  There are only two cases.  */
   if (rhs_elt)
     {
-      if (!rhs_elt->is_scalar)
+      if (!rhs_elt->is_scalar && !TREE_SIDE_EFFECTS (lhs))
        fns->ldst (rhs_elt, lhs, bsi, false);
       else
        fns->use (rhs_elt, &GIMPLE_STMT_OPERAND (expr, 1), bsi, false, false);
@@ -951,7 +951,8 @@ sra_walk_gimple_modify_stmt (tree expr, block_stmt_iterator *bsi,
         The lvalue requirement prevents us from trying to directly scalarize
         the result of a function call.  Which would result in trying to call
         the function multiple times, and other evil things.  */
-      else if (!lhs_elt->is_scalar && is_gimple_addressable (rhs))
+      else if (!lhs_elt->is_scalar
+              && !TREE_SIDE_EFFECTS (rhs) && is_gimple_addressable (rhs))
        fns->ldst (lhs_elt, rhs, bsi, true);
 
       /* Otherwise we're being used in some context that requires the