public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/37795]  New: if-combine doesn't optimize != after >= test
@ 2008-10-10 10:08 rguenth at gcc dot gnu dot org
  2008-10-10 10:08 ` [Bug tree-optimization/37795] " rguenth at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-10-10 10:08 UTC (permalink / raw)
  To: gcc-bugs

int foo (int i, int j)
{
  if (i >= j)
    if (i != j)
      return 0;
  return -1;
}

should be optimized to

  if (i > j)
    return 0;
  return -1;


-- 
           Summary: if-combine doesn't optimize != after >= test
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org
OtherBugsDependingO 36861
             nThis:


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


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

* [Bug tree-optimization/37795] if-combine doesn't optimize != after >= test
  2008-10-10 10:08 [Bug tree-optimization/37795] New: if-combine doesn't optimize != after >= test rguenth at gcc dot gnu dot org
@ 2008-10-10 10:08 ` rguenth at gcc dot gnu dot org
  2008-10-12 18:53 ` rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-10-10 10:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2008-10-10 10:07 -------
Mine.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-10-10 10:07:01
               date|                            |


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


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

* [Bug tree-optimization/37795] if-combine doesn't optimize != after >= test
  2008-10-10 10:08 [Bug tree-optimization/37795] New: if-combine doesn't optimize != after >= test rguenth at gcc dot gnu dot org
  2008-10-10 10:08 ` [Bug tree-optimization/37795] " rguenth at gcc dot gnu dot org
@ 2008-10-12 18:53 ` rguenth at gcc dot gnu dot org
  2008-10-12 20:20 ` ubizjak at gmail dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-10-12 18:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2008-10-12 18:51 -------
Queued for 4.5.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2008-
                   |                            |10/msg00527.html


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


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

* [Bug tree-optimization/37795] if-combine doesn't optimize != after >= test
  2008-10-10 10:08 [Bug tree-optimization/37795] New: if-combine doesn't optimize != after >= test rguenth at gcc dot gnu dot org
  2008-10-10 10:08 ` [Bug tree-optimization/37795] " rguenth at gcc dot gnu dot org
  2008-10-12 18:53 ` rguenth at gcc dot gnu dot org
@ 2008-10-12 20:20 ` ubizjak at gmail dot com
  2008-10-12 20:41 ` rguenther at suse dot de
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: ubizjak at gmail dot com @ 2008-10-12 20:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from ubizjak at gmail dot com  2008-10-12 20:19 -------
Does this patch also solve PR 28685?


-- 


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


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

* [Bug tree-optimization/37795] if-combine doesn't optimize != after >= test
  2008-10-10 10:08 [Bug tree-optimization/37795] New: if-combine doesn't optimize != after >= test rguenth at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-10-12 20:20 ` ubizjak at gmail dot com
@ 2008-10-12 20:41 ` rguenther at suse dot de
  2008-10-12 20:47   ` Andrew Pinski
  2008-10-12 20:49 ` pinskia at gmail dot com
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 10+ messages in thread
From: rguenther at suse dot de @ 2008-10-12 20:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenther at suse dot de  2008-10-12 20:40 -------
Subject: Re:  if-combine doesn't optimize !=
 after >= test

On Sun, 12 Oct 2008, ubizjak at gmail dot com wrote:

> Does this patch also solve PR 28685?

No.  ifcombine only combines on the CFG, in PR28685 we are dealing
with a CFG-less opportunity.

Richard.


-- 


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


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

* Re: [Bug tree-optimization/37795] if-combine doesn't optimize != after >= test
  2008-10-12 20:41 ` rguenther at suse dot de
@ 2008-10-12 20:47   ` Andrew Pinski
  0 siblings, 0 replies; 10+ messages in thread
From: Andrew Pinski @ 2008-10-12 20:47 UTC (permalink / raw)
  To: gcc-bugzilla; +Cc: gcc-bugs

On Sun, Oct 12, 2008 at 1:40 PM, rguenther at suse dot de
<gcc-bugzilla@gcc.gnu.org> wrote:
> No.  ifcombine only combines on the CFG, in PR28685 we are dealing
> with a CFG-less opportunity.

Well it depends really.  As on some targets it has a CFG based ||/&&
depending on BRANCH_COST.

Thanks,
Andrew Pinski


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

* [Bug tree-optimization/37795] if-combine doesn't optimize != after >= test
  2008-10-10 10:08 [Bug tree-optimization/37795] New: if-combine doesn't optimize != after >= test rguenth at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-10-12 20:41 ` rguenther at suse dot de
@ 2008-10-12 20:49 ` pinskia at gmail dot com
  2008-10-12 20:52 ` rguenther at suse dot de
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: pinskia at gmail dot com @ 2008-10-12 20:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gmail dot com  2008-10-12 20:47 -------
Subject: Re:  if-combine doesn't optimize != after >= test

On Sun, Oct 12, 2008 at 1:40 PM, rguenther at suse dot de
<gcc-bugzilla@gcc.gnu.org> wrote:
> No.  ifcombine only combines on the CFG, in PR28685 we are dealing
> with a CFG-less opportunity.

Well it depends really.  As on some targets it has a CFG based ||/&&
depending on BRANCH_COST.

Thanks,
Andrew Pinski


-- 


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


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

* [Bug tree-optimization/37795] if-combine doesn't optimize != after >= test
  2008-10-10 10:08 [Bug tree-optimization/37795] New: if-combine doesn't optimize != after >= test rguenth at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2008-10-12 20:49 ` pinskia at gmail dot com
@ 2008-10-12 20:52 ` rguenther at suse dot de
  2009-03-28 10:02 ` rguenth at gcc dot gnu dot org
  2009-03-28 10:03 ` rguenth at gcc dot gnu dot org
  7 siblings, 0 replies; 10+ messages in thread
From: rguenther at suse dot de @ 2008-10-12 20:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenther at suse dot de  2008-10-12 20:51 -------
Subject: Re:  if-combine doesn't optimize !=
 after >= test

On Sun, 12 Oct 2008, pinskia at gmail dot com wrote:

> ------- Comment #5 from pinskia at gmail dot com  2008-10-12 20:47 -------
> Subject: Re:  if-combine doesn't optimize != after >= test
> 
> On Sun, Oct 12, 2008 at 1:40 PM, rguenther at suse dot de
> <gcc-bugzilla@gcc.gnu.org> wrote:
> > No.  ifcombine only combines on the CFG, in PR28685 we are dealing
> > with a CFG-less opportunity.
> 
> Well it depends really.  As on some targets it has a CFG based ||/&&
> depending on BRANCH_COST.

In that case we already optimize it.

Richard.


-- 


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


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

* [Bug tree-optimization/37795] if-combine doesn't optimize != after >= test
  2008-10-10 10:08 [Bug tree-optimization/37795] New: if-combine doesn't optimize != after >= test rguenth at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2008-10-12 20:52 ` rguenther at suse dot de
@ 2009-03-28 10:02 ` rguenth at gcc dot gnu dot org
  2009-03-28 10:03 ` rguenth at gcc dot gnu dot org
  7 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-03-28 10:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenth at gcc dot gnu dot org  2009-03-28 10:02 -------
Subject: Bug 37795

Author: rguenth
Date: Sat Mar 28 10:01:56 2009
New Revision: 145170

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145170
Log:
2009-03-28  Richard Guenther  <rguenther@suse.de>

        PR tree-optimization/37795
        * tree.h (combine_comparisons): Declare.
        * fold-const.c (combine_comparisons): Export.
        * tree-ssa-ifcombine.c (ifcombine_ifandif): Optimize two successive
        comparisons.
        (ifcombine_iforif): Use combine_comparisons.

        * gcc.dg/tree-ssa/ssa-ifcombine-7.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-7.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-ifcombine.c
    trunk/gcc/tree.h


-- 


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


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

* [Bug tree-optimization/37795] if-combine doesn't optimize != after >= test
  2008-10-10 10:08 [Bug tree-optimization/37795] New: if-combine doesn't optimize != after >= test rguenth at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2009-03-28 10:02 ` rguenth at gcc dot gnu dot org
@ 2009-03-28 10:03 ` rguenth at gcc dot gnu dot org
  7 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-03-28 10:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from rguenth at gcc dot gnu dot org  2009-03-28 10:02 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.0


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


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

end of thread, other threads:[~2009-03-28 10:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-10 10:08 [Bug tree-optimization/37795] New: if-combine doesn't optimize != after >= test rguenth at gcc dot gnu dot org
2008-10-10 10:08 ` [Bug tree-optimization/37795] " rguenth at gcc dot gnu dot org
2008-10-12 18:53 ` rguenth at gcc dot gnu dot org
2008-10-12 20:20 ` ubizjak at gmail dot com
2008-10-12 20:41 ` rguenther at suse dot de
2008-10-12 20:47   ` Andrew Pinski
2008-10-12 20:49 ` pinskia at gmail dot com
2008-10-12 20:52 ` rguenther at suse dot de
2009-03-28 10:02 ` rguenth at gcc dot gnu dot org
2009-03-28 10:03 ` 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).