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; 4+ 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] 4+ messages in thread

* [Bug tree-optimization/28794] missed optimization with non COND_EXPR and vrp and comparisions
  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 ` 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
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-08-21 23:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-08-21 23:31 -------
I found this while trying to figure out how to get VRP to optimize:
a_1 != 0 into a_1 if the range of a_1 is [0,1] (well with a NOP_EXPR).
If I do it inside simplify_cond_using_ranges, I miss all the MODIFY_EXPRs.


-- 


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/28794] missed optimization with non-COND_EXPR and vrp and comparisions
  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 ` pinskia at gcc dot gnu dot org
  2006-08-22  8:10 ` rguenth at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-08-21 23:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-08-21 23:52 -------
For x86, there is no difference in the code gen for f and f1/f2, but for PPC32,
there is:
for f1/f2:
        addic %r0,%r31,-1
        subfe %r3,%r0,%r31

For f:
        srawi %r3,%r31,31
        subf %r3,%r31,%r3
        srwi %r3,%r3,31


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|missed optimization with non|missed optimization with
                   |COND_EXPR and vrp and       |non-COND_EXPR and vrp and
                   |comparisions                |comparisions


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/28794] missed optimization with non-COND_EXPR and vrp and comparisions
  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
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-08-22  8:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2006-08-22 08:10 -------
Confirmed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-08-22 08:10:03
               date|                            |


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-08-22  8:10 UTC | newest]

Thread overview: 4+ 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

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).