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/23619] New: Missed pre opportunity


On the following testcase:

int a[100];

void foo(int p, int q)
{
  int i;

  for (i = 0; i < 100; i++)
    if (i & 8)
      a[i] = (p + q) + 2;
    else
      a[i] = (p + q) + 4;
}

I expected (p+q) to be moved out of loop by pre, but it does not happen. At
first I thought this is caused by reassociation, which modifies the loop to

  for (i = 0; i < 100; i++)
    if (i & 8)
      a[i] = (p + 2) + q;
    else
      a[i] = (p + 4) + q;

But even with reassociation disabled, PRE does nothing.

-- 
           Summary: Missed pre opportunity
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rakdver at gcc dot gnu dot org
                CC: dberlin at gcc dot gnu dot org,gcc-bugs at gcc dot gnu
                    dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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