Question on cfg_remove_useless_stmts_bb

Jeffrey A Law law@redhat.com
Wed Sep 1 06:22:00 GMT 2004


On Wed, 2004-08-18 at 05:42, Richard Kenner wrote:
>     the fact that it wasn't obvious to you is a good indication that I
>     should have had more comments in that code.
> 
> Actually, there's still some confusion there.  Now that you've pointed it
> out, from the way I read that code, VAL is always either a PARM_DECL or
> a VAR_DECL.  So why test !TREE_CONSTANT (val)?
VAL can certainly be a constant.  Consider

if (a == 42)

Which should match:

      if (TREE_CODE (cond) == EQ_EXPR
          && (TREE_CODE (TREE_OPERAND (cond, 0)) == VAR_DECL
              || TREE_CODE (TREE_OPERAND (cond, 0)) == PARM_DECL)
          && (TREE_CODE (TREE_OPERAND (cond, 1)) == VAR_DECL
              || TREE_CODE (TREE_OPERAND (cond, 1)) == PARM_DECL
              || TREE_CONSTANT (TREE_OPERAND (cond, 1))))


FWIW, this is one of the things that could likely go away if we
don't translate trees out of SSA form -- this code exists merely
to clean up trivial redundancies created by the out-of-ssa
translation pass.

Jeff



More information about the Gcc mailing list