I noticed this while looking into tree-ssa-sccvn.c sources (though I doubt it
helps in general really).  But anyways we should optimize the following code
into just a "return 0;":
struct f
{
  int t, k;
  int g[1024];
};


int g(void)
{
  struct f a;
  __builtin_memset(&a, 0, sizeof(a));
  return a.t;
}

-- CUT ---
You can see that with the above code we get a zeroing for the struct still.


-- 
           Summary: memset should be optimized into an empty CONSTRUCTOR
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, TREE
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36602

Reply via email to