This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Question on cfg_remove_useles_stmts_bb
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- To: law at redhat dot com
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 17 Aug 04 06:51:58 EDT
- Subject: Re: Question on cfg_remove_useles_stmts_bb
> How does this get away with not checking that VAL has been clobbered?
?!? It certainly checks whether or not the value is clobbered.
/* Invalidate the var if we encounter something that could modify it. */
if (TREE_CODE (stmt) == ASM_EXPR
|| (TREE_CODE (stmt) == MODIFY_EXPR
&& TREE_OPERAND (stmt, 0) == var))
return;
I said *VAL*, not *VAR*!
It starts up "knowing" the VAR's last value was VAL and then will
eliminate a subsequent assignment of VAL to VAR if it sees one.
That indeed isn't safe if VAR is modified (as tested above), but also
if VAL changes. Since this is called from tree-outof-ssa, it can't
rely on there being no assignment to anything in VAL (which can be an
arbitrary expression.) This appears to be a latent bug which something
I've done has tripped on.