public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/27302]  New: Fold does not fold i < j == j > i to 1
@ 2006-04-25 10:27 rguenth at gcc dot gnu dot org
  2006-04-25 18:31 ` [Bug middle-end/27302] Fold does not fold (i < j) == (j > i) " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-04-25 10:27 UTC (permalink / raw)
  To: gcc-bugs

For the testcase

int foo(int i, int j)
{
  return (i < j) == (j > i);
}

fold does not fold the expression to 1, but instead to
  i < j ^ j > i
which should be done as a last resort only.  fold_comparison does not
handle the original tree either, nor does operand_equal_p see that both
operands of the EQ_EXPR are "equal".


-- 
           Summary: Fold does not fold i < j == j > i to 1
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


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


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

* [Bug middle-end/27302] Fold does not fold (i < j) == (j > i) to 1
  2006-04-25 10:27 [Bug middle-end/27302] New: Fold does not fold i < j == j > i to 1 rguenth at gcc dot gnu dot org
@ 2006-04-25 18:31 ` pinskia at gcc dot gnu dot org
  2006-05-06 13:52 ` rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-25 18:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-04-25 18:31 -------
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-04-25 18:31:38
               date|                            |
            Summary|Fold does not fold i < j == |Fold does not fold (i < j)
                   |j > i to 1                  |== (j > i) to 1


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


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

* [Bug middle-end/27302] Fold does not fold (i < j) == (j > i) to 1
  2006-04-25 10:27 [Bug middle-end/27302] New: Fold does not fold i < j == j > i to 1 rguenth at gcc dot gnu dot org
  2006-04-25 18:31 ` [Bug middle-end/27302] Fold does not fold (i < j) == (j > i) " pinskia at gcc dot gnu dot org
@ 2006-05-06 13:52 ` rguenth at gcc dot gnu dot org
  2006-05-10 10:22 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-05-06 13:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2006-05-06 13:52 -------
Working on a patch.


-- 

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|NEW                         |ASSIGNED
   Last reconfirmed|2006-04-25 18:31:38         |2006-05-06 13:52:08
               date|                            |


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


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

* [Bug middle-end/27302] Fold does not fold (i < j) == (j > i) to 1
  2006-04-25 10:27 [Bug middle-end/27302] New: Fold does not fold i < j == j > i to 1 rguenth at gcc dot gnu dot org
  2006-04-25 18:31 ` [Bug middle-end/27302] Fold does not fold (i < j) == (j > i) " pinskia at gcc dot gnu dot org
  2006-05-06 13:52 ` rguenth at gcc dot gnu dot org
@ 2006-05-10 10:22 ` rguenth at gcc dot gnu dot org
  2006-05-10 11:03 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-05-10 10:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2006-05-10 10:22 -------
Subject: Bug 27302

Author: rguenth
Date: Wed May 10 10:22:39 2006
New Revision: 113670

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113670
Log:
2006-05-10  Richard Guenther  <rguenther@suse.de>

        PR tree-optimization/27302
        * fold-const.c (operand_equal_p): For two comparisons,
        try comparison of one comparison code swapped if that yields
        the same code.

        * gcc.dg/torture/pr27302.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr27302.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug middle-end/27302] Fold does not fold (i < j) == (j > i) to 1
  2006-04-25 10:27 [Bug middle-end/27302] New: Fold does not fold i < j == j > i to 1 rguenth at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2006-05-10 10:22 ` rguenth at gcc dot gnu dot org
@ 2006-05-10 11:03 ` rguenth at gcc dot gnu dot org
  2006-05-15 19:38 ` patchapp at dberlin dot org
  2007-02-06 12:39 ` rguenth at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-05-10 11:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2006-05-10 11:03 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

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


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


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

* [Bug middle-end/27302] Fold does not fold (i < j) == (j > i) to 1
  2006-04-25 10:27 [Bug middle-end/27302] New: Fold does not fold i < j == j > i to 1 rguenth at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2006-05-10 11:03 ` rguenth at gcc dot gnu dot org
@ 2006-05-15 19:38 ` patchapp at dberlin dot org
  2007-02-06 12:39 ` rguenth at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: patchapp at dberlin dot org @ 2006-05-15 19:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from patchapp at dberlin dot org  2006-05-15 19:37 -------
Subject: Bug number PR27302

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2006-05/msg00344.html


-- 


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


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

* [Bug middle-end/27302] Fold does not fold (i < j) == (j > i) to 1
  2006-04-25 10:27 [Bug middle-end/27302] New: Fold does not fold i < j == j > i to 1 rguenth at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2006-05-15 19:38 ` patchapp at dberlin dot org
@ 2007-02-06 12:39 ` rguenth at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-02-06 12:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2007-02-06 12:38 -------
Subject: Bug 27302

Author: rguenth
Date: Tue Feb  6 12:38:32 2007
New Revision: 121644

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121644
Log:
2007-02-06  Richard Guenther  <rguenther@suse.de>

        PR middle-end/27302
        * gcc.dg/torture/pr27302-2.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr27302-2.c
Modified:
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

end of thread, other threads:[~2007-02-06 12:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-25 10:27 [Bug middle-end/27302] New: Fold does not fold i < j == j > i to 1 rguenth at gcc dot gnu dot org
2006-04-25 18:31 ` [Bug middle-end/27302] Fold does not fold (i < j) == (j > i) " pinskia at gcc dot gnu dot org
2006-05-06 13:52 ` rguenth at gcc dot gnu dot org
2006-05-10 10:22 ` rguenth at gcc dot gnu dot org
2006-05-10 11:03 ` rguenth at gcc dot gnu dot org
2006-05-15 19:38 ` patchapp at dberlin dot org
2007-02-06 12:39 ` 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).