This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Question on cfg_remove_useless_stmts_bb
- From: Jeffrey A Law <law at redhat dot com>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 17 Aug 2004 01:04:35 -0600
- Subject: Re: Question on cfg_remove_useless_stmts_bb
- Organization: Red Hat, Inc
- References: <10408131953.AA16722@vlsi1.ultra.nyu.edu>
- Reply-to: law at redhat dot com
On Fri, 2004-08-13 at 13:53, Richard Kenner wrote:
> I'm getting a failure on c-torture/execute/930513-2.c with -O3 and what's
> happening is that the out of ssa pass is looking at
>
> if (j != i) goto <L1>; else goto <L2>;
>
> ...
>
> <L2>:;
> i = i + 1;
> j = i;
>
>
> The cfg_remove_useless_stmts_bb knows that J and I are equal. So when it
> gets to the "j = i" assignment, it deletes it. The problem is that it
> doesn't notice that "i = i + 1" clobbers the equality relation.
Ah, yes, the code ought to be checking that both I (VAR) & J (VAL) are
not clobbered. I was pretty sure it did that, but I can't find the
code which verifies that VAL isn't clobbered.
I would think that changing
if (TREE_CODE (stmt) == ASM_EXPR
|| (TREE_CODE (stmt) == MODIFY_EXPR
&& TREE_OPERAND (stmt, 0) == var)
To
if (TREE_CODE (stmt) == ASM_EXPR
|| (TREE_CODE (stmt) == MODIFY_EXPR
&& (TREE_OPERAND (stmt, 0) == var
|| TREE_CODE (stmt, 0) == val)))
Ought to do the trick.
jeff