public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/15758] New: Convert "if (a >= b) X else if (a >= b) Y" into "if (a >= b) X else Y"
@ 2004-06-01  8:25 kazu at cs dot umass dot edu
  2004-06-01  8:27 ` [Bug tree-optimization/15758] Convert "if (a >= b) X else if (a <= " kazu at cs dot umass dot edu
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-06-01  8:25 UTC (permalink / raw)
  To: gcc-bugs

void bar1 (void);
void bar2 (void);

void
foo (unsigned int a, unsigned int b)
{
  if (a >= b)
    bar1 ();
  else if (a <= b)
    bar2 ();
}

The last tree-ssa form looks like so:

foo (a, b)
{
<bb 0>:
  if (a_1 >= b_2) goto <L0>; else goto <L1>;

<L0>:;
  bar1 () [tail call];
  goto <bb 4> (<L3>);

<L1>:;
  if (a_1 <= b_2) goto <L2>; else goto <L3>;

<L2>:;
  bar2 () [tail call];

<L3>:;
  return;

}

Note that we could simply say

foo (a, b)
{
<bb 0>:
  if (a_1 >= b_2) goto <L0>; else goto <L2>;

<L0>:;
  bar1 () [tail call];
  goto <bb 4> (<L3>);

<L2>:;
  bar2 () [tail call];

<L3>:;
  return;

}

because the second "if" is just the opposite of the first "if".
Note that the equality in the second "if" never holds.

-- 
           Summary: Convert "if (a >= b) X else if (a >= b) Y" into "if (a
                    >= b) X else Y"
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kazu at cs dot umass dot edu
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug tree-optimization/15758] Convert "if (a >= b) X else if (a <= b) Y" into "if (a >= b) X else Y"
  2004-06-01  8:25 [Bug tree-optimization/15758] New: Convert "if (a >= b) X else if (a >= b) Y" into "if (a >= b) X else Y" kazu at cs dot umass dot edu
@ 2004-06-01  8:27 ` kazu at cs dot umass dot edu
  2004-06-01 11:21 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-06-01  8:27 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Convert "if (a >= b) X else |Convert "if (a >= b) X else
                   |if (a >= b) Y" into "if (a  |if (a <= b) Y" into "if (a
                   |>= b) X else Y"             |>= b) X else Y"


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


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

* [Bug tree-optimization/15758] Convert "if (a >= b) X else if (a <= b) Y" into "if (a >= b) X else Y"
  2004-06-01  8:25 [Bug tree-optimization/15758] New: Convert "if (a >= b) X else if (a >= b) Y" into "if (a >= b) X else Y" kazu at cs dot umass dot edu
  2004-06-01  8:27 ` [Bug tree-optimization/15758] Convert "if (a >= b) X else if (a <= " kazu at cs dot umass dot edu
@ 2004-06-01 11:21 ` pinskia at gcc dot gnu dot org
  2004-06-14 20:43 ` law at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-01 11:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-01 11:21 -------
Confirmed, looks like jump threading needs a little improvement.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-06-01 11:21:15
               date|                            |


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


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

* [Bug tree-optimization/15758] Convert "if (a >= b) X else if (a <= b) Y" into "if (a >= b) X else Y"
  2004-06-01  8:25 [Bug tree-optimization/15758] New: Convert "if (a >= b) X else if (a >= b) Y" into "if (a >= b) X else Y" kazu at cs dot umass dot edu
  2004-06-01  8:27 ` [Bug tree-optimization/15758] Convert "if (a >= b) X else if (a <= " kazu at cs dot umass dot edu
  2004-06-01 11:21 ` pinskia at gcc dot gnu dot org
@ 2004-06-14 20:43 ` law at gcc dot gnu dot org
  2004-06-16  6:09 ` kazu at cs dot umass dot edu
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: law at gcc dot gnu dot org @ 2004-06-14 20:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From law at gcc dot gnu dot org  2004-06-14 20:43 -------


*** This bug has been marked as a duplicate of 15757 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


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


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

* [Bug tree-optimization/15758] Convert "if (a >= b) X else if (a <= b) Y" into "if (a >= b) X else Y"
  2004-06-01  8:25 [Bug tree-optimization/15758] New: Convert "if (a >= b) X else if (a >= b) Y" into "if (a >= b) X else Y" kazu at cs dot umass dot edu
                   ` (2 preceding siblings ...)
  2004-06-14 20:43 ` law at gcc dot gnu dot org
@ 2004-06-16  6:09 ` kazu at cs dot umass dot edu
  2004-06-16  6:16 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-06-16  6:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2004-06-16 06:09 -------
This PR is not identical to PR 15757.

Even with Jeff Law's patch, I still get the same t50.tailc.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|DUPLICATE                   |


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


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

* [Bug tree-optimization/15758] Convert "if (a >= b) X else if (a <= b) Y" into "if (a >= b) X else Y"
  2004-06-01  8:25 [Bug tree-optimization/15758] New: Convert "if (a >= b) X else if (a >= b) Y" into "if (a >= b) X else Y" kazu at cs dot umass dot edu
                   ` (3 preceding siblings ...)
  2004-06-16  6:09 ` kazu at cs dot umass dot edu
@ 2004-06-16  6:16 ` pinskia at gcc dot gnu dot org
  2004-06-24 16:20 ` law at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-16  6:16 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |NEW


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


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

* [Bug tree-optimization/15758] Convert "if (a >= b) X else if (a <= b) Y" into "if (a >= b) X else Y"
  2004-06-01  8:25 [Bug tree-optimization/15758] New: Convert "if (a >= b) X else if (a >= b) Y" into "if (a >= b) X else Y" kazu at cs dot umass dot edu
                   ` (4 preceding siblings ...)
  2004-06-16  6:16 ` pinskia at gcc dot gnu dot org
@ 2004-06-24 16:20 ` law at gcc dot gnu dot org
  2004-06-24 16:25 ` pinskia at gcc dot gnu dot org
  2004-07-10  0:37 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: law at gcc dot gnu dot org @ 2004-06-24 16:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From law at gcc dot gnu dot org  2004-06-24 15:58 -------
Fixed with today's checkin.


-- 


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


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

* [Bug tree-optimization/15758] Convert "if (a >= b) X else if (a <= b) Y" into "if (a >= b) X else Y"
  2004-06-01  8:25 [Bug tree-optimization/15758] New: Convert "if (a >= b) X else if (a >= b) Y" into "if (a >= b) X else Y" kazu at cs dot umass dot edu
                   ` (5 preceding siblings ...)
  2004-06-24 16:20 ` law at gcc dot gnu dot org
@ 2004-06-24 16:25 ` pinskia at gcc dot gnu dot org
  2004-07-10  0:37 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-24 16:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-24 16:20 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug tree-optimization/15758] Convert "if (a >= b) X else if (a <= b) Y" into "if (a >= b) X else Y"
  2004-06-01  8:25 [Bug tree-optimization/15758] New: Convert "if (a >= b) X else if (a >= b) Y" into "if (a >= b) X else Y" kazu at cs dot umass dot edu
                   ` (6 preceding siblings ...)
  2004-06-24 16:25 ` pinskia at gcc dot gnu dot org
@ 2004-07-10  0:37 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-10  0:37 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |3.5.0


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


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

end of thread, other threads:[~2004-07-10  0:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-01  8:25 [Bug tree-optimization/15758] New: Convert "if (a >= b) X else if (a >= b) Y" into "if (a >= b) X else Y" kazu at cs dot umass dot edu
2004-06-01  8:27 ` [Bug tree-optimization/15758] Convert "if (a >= b) X else if (a <= " kazu at cs dot umass dot edu
2004-06-01 11:21 ` pinskia at gcc dot gnu dot org
2004-06-14 20:43 ` law at gcc dot gnu dot org
2004-06-16  6:09 ` kazu at cs dot umass dot edu
2004-06-16  6:16 ` pinskia at gcc dot gnu dot org
2004-06-24 16:20 ` law at gcc dot gnu dot org
2004-06-24 16:25 ` pinskia at gcc dot gnu dot org
2004-07-10  0:37 ` pinskia 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).