public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/28794]  New: missed optimization with non COND_EXPR and vrp and comparisions
@ 2006-08-21 23:24 pinskia at gcc dot gnu dot org
  2006-08-21 23:31 ` [Bug tree-optimization/28794] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-08-21 23:24 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 10+ messages in thread
[parent not found: <bug-28794-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2023-08-08 15:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-21 23:24 [Bug tree-optimization/28794] New: missed optimization with non COND_EXPR and vrp and comparisions pinskia at gcc dot gnu dot org
2006-08-21 23:31 ` [Bug tree-optimization/28794] " pinskia at gcc dot gnu dot org
2006-08-21 23:53 ` [Bug tree-optimization/28794] missed optimization with non-COND_EXPR " pinskia at gcc dot gnu dot org
2006-08-22  8:10 ` rguenth at gcc dot gnu dot org
     [not found] <bug-28794-4@http.gcc.gnu.org/bugzilla/>
2021-06-08  7:50 ` pinskia at gcc dot gnu.org
2023-08-07  5:57 ` pinskia at gcc dot gnu.org
2023-08-07  6:27 ` pinskia at gcc dot gnu.org
2023-08-07  6:44 ` pinskia at gcc dot gnu.org
2023-08-08 15:42 ` cvs-commit at gcc dot gnu.org
2023-08-08 15:43 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).