public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/15452] New: [tree-ssa] Optimize cascaded a = a == 0;
@ 2004-05-15 18:25 kazu at cs dot umass dot edu
  2004-05-15 18:35 ` [Bug tree-optimization/15452] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-05-15 18:25 UTC (permalink / raw)
  To: gcc-bugs

This is very similar to PR 14758.

int
foo (int a)
{
  a = !a;
  a = !a;
  a = !a;
  a = !a;
  a = !a;
  return a;
}

I get:

foo (a)
{
<bb 0>:
  a_2 = a_1 == 0;
  a_3 = a_2 == 0;
  a_4 = a_3 == 0;
  a_5 = a_4 == 0;
  a_6 = a_5 == 0;
  return a_6;

}

Do the obvious optimization.

-- 
           Summary: [tree-ssa] Optimize cascaded a = a == 0;
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Keywords: pessimizes-code
          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=15452


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

* [Bug tree-optimization/15452] [tree-ssa] Optimize cascaded a = a == 0;
  2004-05-15 18:25 [Bug tree-optimization/15452] New: [tree-ssa] Optimize cascaded a = a == 0; kazu at cs dot umass dot edu
@ 2004-05-15 18:35 ` pinskia at gcc dot gnu dot org
  2004-05-17 18:25 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-15 18:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-15 03:40 -------
Confirmed, I think this is what a TREE combiner (just like the rtl one) would do just like a couple of your 
other bugs.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |TREE
   Last reconfirmed|0000-00-00 00:00:00         |2004-05-15 03:40:47
               date|                            |


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


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

* [Bug tree-optimization/15452] [tree-ssa] Optimize cascaded a = a == 0;
  2004-05-15 18:25 [Bug tree-optimization/15452] New: [tree-ssa] Optimize cascaded a = a == 0; kazu at cs dot umass dot edu
  2004-05-15 18:35 ` [Bug tree-optimization/15452] " pinskia at gcc dot gnu dot org
@ 2004-05-17 18:25 ` pinskia at gcc dot gnu dot org
  2004-05-31  6:47 ` pinskia at gcc dot gnu dot org
  2004-06-21  5:14 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-17 18:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-17 01:58 -------
Definitely will be fixed when PR 15459 is fixed.

-- 


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


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

* [Bug tree-optimization/15452] [tree-ssa] Optimize cascaded a = a == 0;
  2004-05-15 18:25 [Bug tree-optimization/15452] New: [tree-ssa] Optimize cascaded a = a == 0; kazu at cs dot umass dot edu
  2004-05-15 18:35 ` [Bug tree-optimization/15452] " pinskia at gcc dot gnu dot org
  2004-05-17 18:25 ` pinskia at gcc dot gnu dot org
@ 2004-05-31  6:47 ` pinskia at gcc dot gnu dot org
  2004-06-21  5:14 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-31  6:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-30 04:55 -------
Mine.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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


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

* [Bug tree-optimization/15452] [tree-ssa] Optimize cascaded a = a == 0;
  2004-05-15 18:25 [Bug tree-optimization/15452] New: [tree-ssa] Optimize cascaded a = a == 0; kazu at cs dot umass dot edu
                   ` (2 preceding siblings ...)
  2004-05-31  6:47 ` pinskia at gcc dot gnu dot org
@ 2004-06-21  5:14 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-21  5:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-21 05:14 -------
Will be submitting my tree combiner tonight.

-- 


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


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

* [Bug tree-optimization/15452] [tree-ssa] Optimize cascaded a = a == 0;
       [not found] <bug-15452-4@http.gcc.gnu.org/bugzilla/>
@ 2014-10-31  4:02 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-10-31  4:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15452
Bug 15452 depends on bug 15459, which changed state.

Bug 15459 Summary: [meta-bug] there should be a tree combiner like the rtl one
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15459

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


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

* [Bug tree-optimization/15452] [tree-ssa] Optimize cascaded a = a == 0;
       [not found] <bug-15452-5009@http.gcc.gnu.org/bugzilla/>
  2006-08-24  4:28 ` pinskia at gcc dot gnu dot org
  2006-08-24 14:43 ` dberlin at dberlin dot org
@ 2009-04-22 21:05 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-04-22 21:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pinskia at gcc dot gnu dot org  2009-04-22 21:05 -------
This has been fixed for a while now, at least since 4.4.0.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.4.0


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


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

* Re: [Bug tree-optimization/15452] [tree-ssa] Optimize cascaded a  = a == 0;
  2006-08-24  4:28 ` pinskia at gcc dot gnu dot org
@ 2006-08-24 14:43   ` Daniel Berlin
  0 siblings, 0 replies; 11+ messages in thread
From: Daniel Berlin @ 2006-08-24 14:43 UTC (permalink / raw)
  To: gcc-bugzilla; +Cc: gcc-bugs

pinskia at gcc dot gnu dot org wrote:
> ------- Comment #6 from pinskia at gcc dot gnu dot org  2006-08-24 04:27 -------
> Another interesting case would be (but which could be handled by VRP):
> int
> foo (int a)
> {
>   a = a!=0;
>   a = a!=0;
>   a = a!=0;
>   a = a!=0;
>   a = a!=0;
>   return a;
> }
> Which should be optimized to:
> int foo(int a) { return a!=0;}
> 
> 
Uh, FRE could also optimize this to the same thing, I just don't
remember whether it bothers to look at conditionals as eliminable
expressions.


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

* [Bug tree-optimization/15452] [tree-ssa] Optimize cascaded a = a == 0;
       [not found] <bug-15452-5009@http.gcc.gnu.org/bugzilla/>
  2006-08-24  4:28 ` pinskia at gcc dot gnu dot org
@ 2006-08-24 14:43 ` dberlin at dberlin dot org
  2009-04-22 21:05 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 11+ messages in thread
From: dberlin at dberlin dot org @ 2006-08-24 14:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from dberlin at gcc dot gnu dot org  2006-08-24 14:43 -------
Subject: Re:  [tree-ssa] Optimize cascaded a
 = a == 0;

pinskia at gcc dot gnu dot org wrote:
> ------- Comment #6 from pinskia at gcc dot gnu dot org  2006-08-24 04:27 -------
> Another interesting case would be (but which could be handled by VRP):
> int
> foo (int a)
> {
>   a = a!=0;
>   a = a!=0;
>   a = a!=0;
>   a = a!=0;
>   a = a!=0;
>   return a;
> }
> Which should be optimized to:
> int foo(int a) { return a!=0;}
> 
> 
Uh, FRE could also optimize this to the same thing, I just don't
remember whether it bothers to look at conditionals as eliminable
expressions.


-- 


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


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

* [Bug tree-optimization/15452] [tree-ssa] Optimize cascaded a = a == 0;
       [not found] <bug-15452-5009@http.gcc.gnu.org/bugzilla/>
@ 2006-08-24  4:28 ` pinskia at gcc dot gnu dot org
  2006-08-24 14:43   ` Daniel Berlin
  2006-08-24 14:43 ` dberlin at dberlin dot org
  2009-04-22 21:05 ` pinskia at gcc dot gnu dot org
  2 siblings, 1 reply; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-08-24  4:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2006-08-24 04:27 -------
Another interesting case would be (but which could be handled by VRP):
int
foo (int a)
{
  a = a!=0;
  a = a!=0;
  a = a!=0;
  a = a!=0;
  a = a!=0;
  return a;
}
Which should be optimized to:
int foo(int a) { return a!=0;}


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org


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


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

* [Bug tree-optimization/15452] [tree-ssa] Optimize cascaded a = a == 0;
       [not found] <20040515032618.15452.kazu@gcc.gnu.org>
@ 2005-07-12 21:27 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-12 21:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-12 21:26 -------
It might be a while for me to rewrite the tree combiner so unassigning for now.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|pinskia at gcc dot gnu dot  |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


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


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

end of thread, other threads:[~2014-10-31  4:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-15 18:25 [Bug tree-optimization/15452] New: [tree-ssa] Optimize cascaded a = a == 0; kazu at cs dot umass dot edu
2004-05-15 18:35 ` [Bug tree-optimization/15452] " pinskia at gcc dot gnu dot org
2004-05-17 18:25 ` pinskia at gcc dot gnu dot org
2004-05-31  6:47 ` pinskia at gcc dot gnu dot org
2004-06-21  5:14 ` pinskia at gcc dot gnu dot org
     [not found] <20040515032618.15452.kazu@gcc.gnu.org>
2005-07-12 21:27 ` pinskia at gcc dot gnu dot org
     [not found] <bug-15452-5009@http.gcc.gnu.org/bugzilla/>
2006-08-24  4:28 ` pinskia at gcc dot gnu dot org
2006-08-24 14:43   ` Daniel Berlin
2006-08-24 14:43 ` dberlin at dberlin dot org
2009-04-22 21:05 ` pinskia at gcc dot gnu dot org
     [not found] <bug-15452-4@http.gcc.gnu.org/bugzilla/>
2014-10-31  4:02 ` pinskia 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).