This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/49367] New: missed optimization with __restrict field


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

           Summary: missed optimization with __restrict field
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: trivial
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jason@gcc.gnu.org


GCC fails to optimize away the call to g() in this C testcase.  It should
recognize that since we've established that a1 is different from a2, their
pointer fields must also be disjoint.  This is necessary to be able to improve
optimization of C++ container classes, which currently have worse performance
than raw restricted pointers.

typedef struct A
{
  int *__restrict p;
} A;

void g();

void f (A* a1, A* a2)
{
  if (a1 == a2)
    return;

  *a1->p = 0;
  *a2->p = 1;
  if (*a1->p != 0)
    g();
}

int main()
{
  A a,b;
  f (&a,&b);
}


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