Testcase:
#define SIZE 1024
While looking into why manually SRA'd testcase worked better. I found this
interesting problem.
Take:
struct a
{
  long long b;
  a();
};
a f(a &g, a &h)
{
  int i;
  a res = g;
  for (i = 0; i < SIZE; i++)
    res.b += h.b;
  return res;
}

at -O2 we change res here to <retval> so we have <retval> in the inner loop. 
If we supply -fno-elide-constructors which disables NVR in C++ front-end, we
get good code of doing loop based Copy Prop (SCEV copy prop) as we able to pull
out res.b.  The issue is that we say h can alias <retval> but we don't say the
same thing for res though.


-- 
           Summary: NVR in the front-end causes missed optimization later on
                    (<retval> thought to alias arguments)
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, alias
          Severity: enhancement
          Priority: P3
         Component: middle-end
        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=36201

Reply via email to