From 631b67ce1f819a4122eaf8b46f725dc5ff5ebd1d Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Tue, 31 Aug 2004 22:28:44 +0000 Subject: [PATCH] tree-cfg.c (cfg_remove_useless_stmts_bb): Also invalidate if VAL gets modified. * tree-cfg.c (cfg_remove_useless_stmts_bb): Also invalidate if VAL gets modified. Co-Authored-By: Jeff Law From-SVN: r86847 --- gcc/ChangeLog | 6 ++++++ gcc/tree-cfg.c | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index af60798b7c6..1cddc302288 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-08-31 Richard Kenner + Jeff Law + + * tree-cfg.c (cfg_remove_useless_stmts_bb): Also invalidate if VAL + gets modified. + 2004-08-31 Mark Mitchell * hooks.c (hook_bool_void_true): New function. diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index dab912550d6..ae9521e0d0d 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -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);