[RFC] Redundant zero store elimination (PR31150)

Zdenek Dvorak rakdver@kam.mff.cuni.cz
Fri Sep 7 17:21:00 GMT 2007


Hello,

> In this case the optimization decided to delete redundant:
>   Store 
> # HEAP.515D.1988_400 = VDEF <HEAP.515D.1988_402> { HEAP.515D.1988 }
> (*D.1848_489)[2].xD.866.dataD.857 = 0B
>   made redundant by 
> # HEAP.515D.1988_417 = VDEF <HEAP.515D.1988_905> { HEAP.515D.1988 }
> (*D.1848_489)[2].xD.866.dataD.857 = 0B
> 
> so I have bsi_remove(&bsi, true);'ed it and TODO_update_ssa is in
> the pass' todo_flags_finish.  But unfortunately that bsi_remove
> removed the VDEF as well and has not updated the places where
> HEAP.515D.1988_417 is used.
> I tried to release_defs (stmt); after the bsi_remove, but that only
> lead to a different ICE.  Any ideas?

you need replace the VDEF definitions of the removed statement to fix up
the ssa chains:

FOR_EACH_SSA_VDEF_OPERAND (def, use, stmt, iter)
  {
    gcc_assert (VUSE_VECT_NUM_ELEM (*vv) == 1);
    usevar = VUSE_ELEMENT_VAR (*vv, 0);

    replace_uses_by (def, usevar);
  }

Zdenek



More information about the Gcc-patches mailing list