public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/15357] New: [tree-ssa] combing if statements
@ 2004-05-09 22:11 pinskia at gcc dot gnu dot org
  2004-05-09 22:20 ` [Bug optimization/15357] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-09 22:11 UTC (permalink / raw)
  To: gcc-bugs

The following two functions should give the same asm (If the branch cost is high 
enough):
int g(void);
int h(int a, int b, int c, int d)
{
  if (a==b)
   if (c==d)
     return g();
  return 0;
}
int h1(int a, int b, int c, int d)
{
  if (a==b && c==d)
    return g();
  return 0;
}

And these two:
int j(int a, int b, int c, int d)
{
  if (a==b)
   goto a;
  if (c==d)
   goto a;
  else
   goto b;
a:
  return g();
b:
  return 0;
}
int j1(int a, int b, int c, int d)
{
  if (a==b || c==d)
    return g();
  return 0;
}

-- 
           Summary: [tree-ssa] combing if statements
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Keywords: pessimizes-code, memory-hog, compile-time-hog
          Severity: enhancement
          Priority: P2
         Component: optimization
        AssignedTo: pinskia at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
OtherBugsDependingO 15241,15348,15352
             nThis:


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


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

* [Bug optimization/15357] [tree-ssa] combing if statements
  2004-05-09 22:11 [Bug optimization/15357] New: [tree-ssa] combing if statements pinskia at gcc dot gnu dot org
@ 2004-05-09 22:20 ` pinskia at gcc dot gnu dot org
  2004-05-25  0:09 ` [Bug tree-optimization/15357] " pinskia at gcc dot gnu dot org
  2005-05-08 18:17 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-09 22:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-09 22:20 -------
Mine I am working on this, then we should be able to removed this optimization in fold 
which causes this to happen in the one statement one.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-05-09 22:20:20
               date|                            |
   Target Milestone|---                         |tree-ssa


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


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

* [Bug tree-optimization/15357] [tree-ssa] combing if statements
  2004-05-09 22:11 [Bug optimization/15357] New: [tree-ssa] combing if statements pinskia at gcc dot gnu dot org
  2004-05-09 22:20 ` [Bug optimization/15357] " pinskia at gcc dot gnu dot org
@ 2004-05-25  0:09 ` pinskia at gcc dot gnu dot org
  2005-05-08 18:17 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-25  0:09 UTC (permalink / raw)
  To: gcc-bugs



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


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


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

* [Bug tree-optimization/15357] [tree-ssa] combing if statements
  2004-05-09 22:11 [Bug optimization/15357] New: [tree-ssa] combing if statements pinskia at gcc dot gnu dot org
  2004-05-09 22:20 ` [Bug optimization/15357] " pinskia at gcc dot gnu dot org
  2004-05-25  0:09 ` [Bug tree-optimization/15357] " pinskia at gcc dot gnu dot org
@ 2005-05-08 18:17 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-08 18:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-08 18:17 -------
I lost the code which I was using to do this so I am no longer working on this.

-- 
           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=15357


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

* [Bug tree-optimization/15357] [tree-ssa] combing if statements
       [not found] <bug-15357-4@http.gcc.gnu.org/bugzilla/>
  2012-01-21 22:11 ` pinskia at gcc dot gnu.org
@ 2013-11-09 20:40 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-11-09 20:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed by:
2013-10-29  Andrew Pinski <apinski@cavium.com>

        * tree-ssa-ifcombine.c: Include rtl.h and tm_p.h.
        (ifcombine_ifandif): Handle cases where maybe_fold_and_comparisons
        fails, combining the branches anyways.
        (tree_ssa_ifcombine): Inverse the order of the basic block walk,
        increases the number of combinings.
        * gimple.h (gsi_start_nondebug_after_labels_bb): New function.


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

* [Bug tree-optimization/15357] [tree-ssa] combing if statements
       [not found] <bug-15357-4@http.gcc.gnu.org/bugzilla/>
@ 2012-01-21 22:11 ` pinskia at gcc dot gnu.org
  2013-11-09 20:40 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-21 22:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-21 22:02:24 UTC ---
I have a patch which implements this.  I will be posting it for 4.8.


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

* [Bug tree-optimization/15357] [tree-ssa] combing if statements
       [not found] <bug-15357-6528@http.gcc.gnu.org/bugzilla/>
  2007-01-26 13:44 ` rguenth at gcc dot gnu dot org
@ 2007-06-12 12:10 ` rguenth at gcc dot gnu dot org
  1 sibling, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-06-12 12:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2007-06-12 12:10 -------
The new if-combining pass can be told to make the transformation suggested in
the description.


-- 

rguenth at gcc dot gnu dot org changed:

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


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


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

* [Bug tree-optimization/15357] [tree-ssa] combing if statements
       [not found] <bug-15357-6528@http.gcc.gnu.org/bugzilla/>
@ 2007-01-26 13:44 ` rguenth at gcc dot gnu dot org
  2007-06-12 12:10 ` rguenth at gcc dot gnu dot org
  1 sibling, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-01-26 13:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2007-01-26 13:44 -------
Another thing we should be able to do is combine bit-tests like

 if (a & (1 << b))
   if (a & (1 << c))
     ...

to a single test

 if (a & ((1 << b) | (1 << c)) == ((1 << b) | (1 << c)))
   ...


-- 


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


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

end of thread, other threads:[~2013-11-09 20:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-09 22:11 [Bug optimization/15357] New: [tree-ssa] combing if statements pinskia at gcc dot gnu dot org
2004-05-09 22:20 ` [Bug optimization/15357] " pinskia at gcc dot gnu dot org
2004-05-25  0:09 ` [Bug tree-optimization/15357] " pinskia at gcc dot gnu dot org
2005-05-08 18:17 ` pinskia at gcc dot gnu dot org
     [not found] <bug-15357-6528@http.gcc.gnu.org/bugzilla/>
2007-01-26 13:44 ` rguenth at gcc dot gnu dot org
2007-06-12 12:10 ` rguenth at gcc dot gnu dot org
     [not found] <bug-15357-4@http.gcc.gnu.org/bugzilla/>
2012-01-21 22:11 ` pinskia at gcc dot gnu.org
2013-11-09 20:40 ` 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).