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_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.


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