tree-cfg.c (cfg_remove_useless_stmts_bb): Also invalidate if VAL gets modified.
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>
Tue, 31 Aug 2004 22:28:44 +0000 (22:28 +0000)
committerRichard Kenner <kenner@gcc.gnu.org>
Tue, 31 Aug 2004 22:28:44 +0000 (18:28 -0400)
* tree-cfg.c (cfg_remove_useless_stmts_bb): Also invalidate if VAL
gets modified.

Co-Authored-By: Jeff Law <law@redhat.com>
From-SVN: r86847

gcc/ChangeLog
gcc/tree-cfg.c

index af60798b7c6ae60ad38b05f5d30cbc6271f9bc35..1cddc3022889b633fb43d5614c53e1a0227f9931 100644 (file)
@@ -1,3 +1,9 @@
+2004-08-31  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+           Jeff Law  <law@redhat.com>
+
+       * tree-cfg.c (cfg_remove_useless_stmts_bb): Also invalidate if VAL
+       gets modified.
+
 2004-08-31  Mark Mitchell  <mark@codesourcery.com>
 
        * hooks.c (hook_bool_void_true): New function.
index dab912550d61d3813c96bc50dc3a917c334ae197..ae9521e0d0de634e6708c4dfb57707b1943fa0f0 100644 (file)
@@ -1738,10 +1738,14 @@ cfg_remove_useless_stmts_bb (basic_block bb)
          continue;
        }
 
-      /* Invalidate the var if we encounter something that could modify it.  */
+      /* Invalidate the var if we encounter something that could modify it.
+        Likewise for the value it was previously set to.  Note that we only
+        consider values that are either a VAR_DECL or PARM_DECL so we
+        can test for conflict very simply.  */
       if (TREE_CODE (stmt) == ASM_EXPR
          || (TREE_CODE (stmt) == MODIFY_EXPR
-             && TREE_OPERAND (stmt, 0) == var))
+             && (TREE_OPERAND (stmt, 0) == var
+                 || TREE_OPERAND (stmt, 0) == val)))
        return;
   
       bsi_next (&bsi);