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/22548] New: Aliasing can not tell array members apart


For the following testcase (s is global so SRA cannot decompose it), aliasing
can not tell that the store to s.i[1] does not alias s.i[0].  So instead of
optimizing this to return 3; at the tree-level, we do a load of s.i[0].

struct { int i[2]; } s;
int foo(void)
{
  s.i[0] = 1;
  s.i[1] = 2;
  return s.i[0] + s.i[1];
}

Note that it cannot even do this if you remove the wrapping structure,
though you won't find many instances of such in C++ code.  But at least
for this I'd have a patch, if not IVOPTs would suck so much wrt aliasing.

-- 
           Summary: Aliasing can not tell array members apart
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
OtherBugsDependingO 22501
             nThis:


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


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