public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/52005] New: tree-ssa-combineif does not work with some cfgs
@ 2012-01-26  8:03 pinskia at gcc dot gnu.org
  2012-01-26  8:21 ` [Bug tree-optimization/52005] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-26  8:03 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52005
           Summary: tree-ssa-combineif does not work with some cfgs
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: pinskia@gcc.gnu.org


Take:
int f(int x, int a, int b)
{
  int t = 0;
  int c = 1 << a;
  if (!(x & 1))
    t = 0;
  else
    if (x & (1 << 2))
      t = 1;
    else
      t = 0;
  return t;
}

int f1(int x, int a, int b)
{
  int t = 0;
  int c = 1 << a;
  if (x & 1)
    if (x & (1 << 2))
      t = 1;
  return t;
}
--- CUT ---
Both codes are the same.  The first case is not optimized while the second is.
The reason is we have code in ifcombine which only looks for the second case. 
While the first is not caught.


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

* [Bug tree-optimization/52005] tree-ssa-combineif does not work with some cfgs
  2012-01-26  8:03 [Bug tree-optimization/52005] New: tree-ssa-combineif does not work with some cfgs pinskia at gcc dot gnu.org
@ 2012-01-26  8:21 ` pinskia at gcc dot gnu.org
  2012-01-26 23:20 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-26  8:21 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2012-01-26
         AssignedTo|unassigned at gcc dot       |pinskia at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-26 03:55:07 UTC ---
I have a patch.


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

* [Bug tree-optimization/52005] tree-ssa-combineif does not work with some cfgs
  2012-01-26  8:03 [Bug tree-optimization/52005] New: tree-ssa-combineif does not work with some cfgs pinskia at gcc dot gnu.org
  2012-01-26  8:21 ` [Bug tree-optimization/52005] " pinskia at gcc dot gnu.org
@ 2012-01-26 23:20 ` pinskia at gcc dot gnu.org
  2012-08-06 16:39 ` glisse at gcc dot gnu.org
  2012-08-06 16:58 ` glisse at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-26 23:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-26 22:08:05 UTC ---
Here is another testcase:
int f(int x, int a, int b)
{
  int t = 0;
  int c = 1 << a;
  if (!(x & 1))
    t = 0;
  else
    if (x & (1 << 2))
      t = g();
    else
      t = 0;
  return t;
}

The original testcase is not currently optimized with current patch but the
above one is.  I am still on the case of the original testcase.


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

* [Bug tree-optimization/52005] tree-ssa-combineif does not work with some cfgs
  2012-01-26  8:03 [Bug tree-optimization/52005] New: tree-ssa-combineif does not work with some cfgs pinskia at gcc dot gnu.org
  2012-01-26  8:21 ` [Bug tree-optimization/52005] " pinskia at gcc dot gnu.org
  2012-01-26 23:20 ` pinskia at gcc dot gnu.org
@ 2012-08-06 16:39 ` glisse at gcc dot gnu.org
  2012-08-06 16:58 ` glisse at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: glisse at gcc dot gnu.org @ 2012-08-06 16:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Marc Glisse <glisse at gcc dot gnu.org> 2012-08-06 16:38:52 UTC ---
Author: glisse
Date: Mon Aug  6 16:38:48 2012
New Revision: 190184

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190184
Log:
2012-08-06 Marc Glisse <marc.glisse@inria.fr>

gcc/
    PR tree-optimization/51938
    PR tree-optimization/52005
    * tree-ssa-ifcombine.c (ifcombine_ifandif): New parameters for
    inverted conditions.
    (ifcombine_iforif): Remove, merge code into ifcombine_ifandif.
    (tree_ssa_ifcombine_bb): Update calls to the above. Detect !a&&b
    and !a||b patterns.

gcc/testsuite/
    PR tree-optimization/51938
    PR tree-optimization/52005
    * gcc.dg/tree-ssa/ssa-ifcombine-8.c: New testcase.
    * gcc.dg/tree-ssa/ssa-ifcombine-9.c: Likewise.
    * gcc.dg/tree-ssa/ssa-ifcombine-10.c: Likewise.
    * gcc.dg/tree-ssa/ssa-ifcombine-11.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-10.c   (with props)
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-11.c   (with props)
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-8.c   (with props)
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-9.c   (with props)
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-ifcombine.c

Propchange: trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-10.c
            ('svn:eol-style' added)

Propchange: trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-10.c
            ('svn:keywords' added)

Propchange: trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-11.c
            ('svn:eol-style' added)

Propchange: trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-11.c
            ('svn:keywords' added)

Propchange: trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-8.c
            ('svn:eol-style' added)

Propchange: trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-8.c
            ('svn:keywords' added)

Propchange: trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-9.c
            ('svn:eol-style' added)

Propchange: trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-9.c
            ('svn:keywords' added)


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

* [Bug tree-optimization/52005] tree-ssa-combineif does not work with some cfgs
  2012-01-26  8:03 [Bug tree-optimization/52005] New: tree-ssa-combineif does not work with some cfgs pinskia at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2012-08-06 16:39 ` glisse at gcc dot gnu.org
@ 2012-08-06 16:58 ` glisse at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: glisse at gcc dot gnu.org @ 2012-08-06 16:58 UTC (permalink / raw)
  To: gcc-bugs

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

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                 CC|                            |glisse at gcc dot gnu.org
         Resolution|                            |FIXED

--- Comment #4 from Marc Glisse <glisse at gcc dot gnu.org> 2012-08-06 16:58:16 UTC ---
All the above testcases are now optimized (at least at -O2).


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

end of thread, other threads:[~2012-08-06 16:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-26  8:03 [Bug tree-optimization/52005] New: tree-ssa-combineif does not work with some cfgs pinskia at gcc dot gnu.org
2012-01-26  8:21 ` [Bug tree-optimization/52005] " pinskia at gcc dot gnu.org
2012-01-26 23:20 ` pinskia at gcc dot gnu.org
2012-08-06 16:39 ` glisse at gcc dot gnu.org
2012-08-06 16:58 ` glisse 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).