------- Comment #2 from rguenth at gcc dot gnu dot org 2009-06-26 15:12 ------- I have a patch for the DSE part.
The malloc part shouldn't be too difficult. The free part is more interesting. Basically the pointer use in free (p) should mark the malloc necessary but really nothing is there to mark the free necessary if it is (the free is necessary iff the malloc is necessary but nothing provides this link to provide easy integration with the DCE worklist implementation). Maybe a two-stage implementation would work where we replace an unnecessary malloc () with a NULL assignment (so the free becomes a no-op and is eventually folded away after CCP). A little bit hackish - and dependent on free (NULL) (if it happens to persist) to not fault. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |rguenth at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED Last reconfirmed|2007-07-01 00:25:55 |2009-06-26 15:12:33 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19831