This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question on cfg_remove_useless_stmts_bb


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]