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/28794] New: missed optimization with non COND_EXPR and vrp and comparisions


int f(int x, int y)
{
  int t;
  for (t = 0; t < 50; t++)
    g(t>0);
}
void f1(int x, int y)
{
  int t;
  for (t = 0; t < 50; t++)
    g(t!=0);
}

--------------
The above two functions should produce the same code with f1 being better than
f.

If we change it to:
void f2(int x, int y)
{
  int t;
  for (t = 0; t < 50; t++)
  {
    int tt;
    if (t>0)
      tt = 1;
   else
      tt = 0;
   g(tt);
  }
}

-----
We get f1 so we are only folding comparisions in a COND_EXPR which is wrong, we
should also be doing them in MODIFY_EXPRs too.


-- 
           Summary: missed optimization with non COND_EXPR and vrp and
                    comparisions
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          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=28794


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