public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/15353] [tree-ssa] Merge two "if"s if one subsumes the other.
       [not found] <bug-15353-5009@http.gcc.gnu.org/bugzilla/>
@ 2007-04-23 11:48 ` rguenth at gcc dot gnu dot org
  2007-06-12 12:06 ` rguenth at gcc dot gnu dot org
  2007-06-12 12:08 ` rguenth at gcc dot gnu dot org
  2 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-04-23 11:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from rguenth at gcc dot gnu dot org  2007-04-23 12:47 -------
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|NEW                         |ASSIGNED
   Last reconfirmed|2006-10-24 12:39:16         |2007-04-23 12:47:56
               date|                            |


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


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

* [Bug tree-optimization/15353] [tree-ssa] Merge two "if"s if one subsumes the other.
       [not found] <bug-15353-5009@http.gcc.gnu.org/bugzilla/>
  2007-04-23 11:48 ` [Bug tree-optimization/15353] [tree-ssa] Merge two "if"s if one subsumes the other rguenth at gcc dot gnu dot org
@ 2007-06-12 12:06 ` rguenth at gcc dot gnu dot org
  2007-06-12 12:08 ` rguenth at gcc dot gnu dot org
  2 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-06-12 12:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from rguenth at gcc dot gnu dot org  2007-06-12 12:06 -------
Subject: Bug 15353

Author: rguenth
Date: Tue Jun 12 12:06:19 2007
New Revision: 125644

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

        PR tree-optimization/15353
        PR tree-optimization/31657
        * passes.c (init_optimization_passes): Add pass_tree_ifcombine.
        * timevar.def: Add TV_TREE_IFCOMBINE.
        * tree-pass.h (pass_tree_ifcombine): Declare.
        * tree-ssa-ifcombine.c: New file.
        * tree-ssa-phiopt.c (blocks_in_phiopt_order): Export.
        * tree-flow.h (blocks_in_phiopt_order): Declare.
        * Makefile.in (OBJS-common): Add tree-ssa-ifcombine.o.
        (tree-ssa-ifcombine.o): New dependencies.

        * gcc.c-torture/execute/20070424-1.c: New testcase.
        * gcc.dg/tree-ssa/ssa-ifcombine-1.c: Likewise.
        * gcc.dg/tree-ssa/ssa-ifcombine-2.c: Likewise.
        * gcc.dg/tree-ssa/ssa-ifcombine-3.c: Likewise.
        * gcc.dg/tree-ssa/ssa-ifcombine-4.c: Likewise.
        * gcc.dg/tree-ssa/ssa-ifcombine-5.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.c-torture/execute/20070424-1.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-1.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-2.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-3.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-4.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-5.c
    trunk/gcc/tree-ssa-ifcombine.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/Makefile.in
    trunk/gcc/passes.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/timevar.def
    trunk/gcc/tree-flow.h
    trunk/gcc/tree-pass.h
    trunk/gcc/tree-ssa-phiopt.c


-- 


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


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

* [Bug tree-optimization/15353] [tree-ssa] Merge two "if"s if one subsumes the other.
       [not found] <bug-15353-5009@http.gcc.gnu.org/bugzilla/>
  2007-04-23 11:48 ` [Bug tree-optimization/15353] [tree-ssa] Merge two "if"s if one subsumes the other rguenth at gcc dot gnu dot org
  2007-06-12 12:06 ` rguenth at gcc dot gnu dot org
@ 2007-06-12 12:08 ` rguenth at gcc dot gnu dot org
  2 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-06-12 12:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from rguenth at gcc dot gnu dot org  2007-06-12 12:08 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

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


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


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

* [Bug tree-optimization/15353] [tree-ssa] Merge two "if"s if one subsumes the other.
       [not found] <bug-15353-4@http.gcc.gnu.org/bugzilla/>
@ 2013-11-09 20:40 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 12+ 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=15353

Bug 15353 depends on bug 15357, which changed state.

Bug 15357 Summary: [tree-ssa] combing if statements
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15357

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


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

* [Bug tree-optimization/15353] [tree-ssa] Merge two "if"s if one subsumes the other.
       [not found] <20040509200719.15353.kazu@gcc.gnu.org>
                   ` (3 preceding siblings ...)
  2005-08-11 15:52 ` trt at acm dot org
@ 2005-08-11 17:29 ` law at redhat dot com
  4 siblings, 0 replies; 12+ messages in thread
From: law at redhat dot com @ 2005-08-11 17:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From law at redhat dot com  2005-08-11 17:29 -------
Subject: Re:  [tree-ssa] Merge two "if"s if
	one subsumes the other.

On Thu, 2005-08-11 at 15:52 +0000, trt at acm dot org wrote:
> ------- Additional Comments From trt at acm dot org  2005-08-11 15:52 -------
> I think http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21643 is closely related.
It's related.

However, there is a key difference.  In 21643, the object being tested
is a scalar and thus should be subject to optimization by fold-const.c's
range checking optimizations.  ie, the merging of the conditions in the
test should occur well before the SSA optimization path is run.

In 15353 the object being tested is a memory reference and thus we can
not safely merge the tests until later in the optimization path (after
we've exposed the memory loads and proved they're equivalent).

jeff




-- 


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


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

* [Bug tree-optimization/15353] [tree-ssa] Merge two "if"s if one subsumes the other.
       [not found] <20040509200719.15353.kazu@gcc.gnu.org>
                   ` (2 preceding siblings ...)
  2005-08-11 15:43 ` law at redhat dot com
@ 2005-08-11 15:52 ` trt at acm dot org
  2005-08-11 17:29 ` law at redhat dot com
  4 siblings, 0 replies; 12+ messages in thread
From: trt at acm dot org @ 2005-08-11 15:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From trt at acm dot org  2005-08-11 15:52 -------
I think http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21643 is closely related.

-- 


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


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

* [Bug tree-optimization/15353] [tree-ssa] Merge two "if"s if one subsumes the other.
       [not found] <20040509200719.15353.kazu@gcc.gnu.org>
  2005-08-10 18:57 ` law at redhat dot com
  2005-08-11 11:01 ` rguenth at gcc dot gnu dot org
@ 2005-08-11 15:43 ` law at redhat dot com
  2005-08-11 15:52 ` trt at acm dot org
  2005-08-11 17:29 ` law at redhat dot com
  4 siblings, 0 replies; 12+ messages in thread
From: law at redhat dot com @ 2005-08-11 15:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From law at redhat dot com  2005-08-11 15:43 -------
Subject: Re:  [tree-ssa] Merge two "if"s if
	one subsumes the other.

On Thu, 2005-08-11 at 11:01 +0000, rguenth at gcc dot gnu dot org wrote:
> ------- Additional Comments From rguenth at gcc dot gnu dot org  2005-08-11 11:01 -------
> Couldn't DOM do this at jump threading time? I.e.
> 
>   if (D.1286_3 > D.1287_5) goto <L3>; else goto <L1>;
> 
> <L1>:;
>   if (D.1286_3 == D.1287_5) goto <L3>; else goto <L2>;
> 
> during trying of threading through the jump at L1 merge the
> two conditionals?
Jump threading isn't particularly well suited for this kind of
optimization.  

jeff




-- 


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


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

* [Bug tree-optimization/15353] [tree-ssa] Merge two "if"s if one subsumes the other.
       [not found] <20040509200719.15353.kazu@gcc.gnu.org>
  2005-08-10 18:57 ` law at redhat dot com
@ 2005-08-11 11:01 ` rguenth at gcc dot gnu dot org
  2005-08-11 15:43 ` law at redhat dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2005-08-11 11:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rguenth at gcc dot gnu dot org  2005-08-11 11:01 -------
Couldn't DOM do this at jump threading time? I.e.

  if (D.1286_3 > D.1287_5) goto <L3>; else goto <L1>;

<L1>:;
  if (D.1286_3 == D.1287_5) goto <L3>; else goto <L2>;

during trying of threading through the jump at L1 merge the
two conditionals?

Just guessing...

-- 


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


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

* [Bug tree-optimization/15353] [tree-ssa] Merge two "if"s if one subsumes the other.
       [not found] <20040509200719.15353.kazu@gcc.gnu.org>
@ 2005-08-10 18:57 ` law at redhat dot com
  2005-08-11 11:01 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: law at redhat dot com @ 2005-08-10 18:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From law at redhat dot com  2005-08-10 18:57 -------
Subject: Re:  [tree-ssa] Merge two "if"s if
	one subsumes the other.

On Sat, 2005-06-11 at 19:16 +0000, pinskia at gcc dot gnu dot org wrote:
> ------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-11 19:16 -------
> (In reply to comment #3)
> > And it should merge them, too, like for
> 
> I better testcase which shows why we don't convert i > j || i == j into i >= j
> which is reduced from Richard's tramp3d:
> int g(void);
> int h(void);
> int f(int *i, int *j)
> {
>   while (1)
>   {
>     if (*i > *j || *i == *j)
>       break;
>     return g();
>   }
>   return h();
> }

At first I thought we might be able to do this via VRP.  But after more
thought, I don't see this kind of transformation fitting into the VRP
framework.

It wouldn't be terribly hard to write a new optimizer to perform this
transformation, and I would expect it would be pretty efficient.  It
would need to run after copy propagation and DCE since useless
copies would easily get in the way of successful optimization.

I'm pretty sure it could be done with a single pass through the IL.

Jeff



-- 


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


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

* [Bug tree-optimization/15353] [tree-ssa] Merge two "if"s if one subsumes the other.
  2004-05-09 20:07 [Bug optimization/15353] New: " kazu at cs dot umass dot edu
  2004-05-25  0:03 ` [Bug tree-optimization/15353] " pinskia at gcc dot gnu dot org
  2005-06-11 19:06 ` rguenth at gcc dot gnu dot org
@ 2005-06-11 19:16 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-11 19:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-11 19:16 -------
(In reply to comment #3)
> And it should merge them, too, like for

I better testcase which shows why we don't convert i > j || i == j into i >= j
which is reduced from Richard's tramp3d:
int g(void);
int h(void);
int f(int *i, int *j)
{
  while (1)
  {
    if (*i > *j || *i == *j)
      break;
    return g();
  }
  return h();
}


-- 


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


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

* [Bug tree-optimization/15353] [tree-ssa] Merge two "if"s if one subsumes the other.
  2004-05-09 20:07 [Bug optimization/15353] New: " kazu at cs dot umass dot edu
  2004-05-25  0:03 ` [Bug tree-optimization/15353] " pinskia at gcc dot gnu dot org
@ 2005-06-11 19:06 ` rguenth at gcc dot gnu dot org
  2005-06-11 19:16 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2005-06-11 19:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rguenth at gcc dot gnu dot org  2005-06-11 19:05 -------
And it should merge them, too, like for

 int g(void);
 int h(void);
 int f(int i, int j)
 {
   while (1)
   {
     if (i > j)
       break;
     if (i == j)
       break;
     return g();
   }
   return h();
 }


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at tat dot physik
                   |                            |dot uni-tuebingen dot de


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


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

* [Bug tree-optimization/15353] [tree-ssa] Merge two "if"s if one subsumes the other.
  2004-05-09 20:07 [Bug optimization/15353] New: " kazu at cs dot umass dot edu
@ 2004-05-25  0:03 ` pinskia at gcc dot gnu dot org
  2005-06-11 19:06 ` rguenth at gcc dot gnu dot org
  2005-06-11 19:16 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-25  0:03 UTC (permalink / raw)
  To: gcc-bugs



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


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


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

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

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-15353-5009@http.gcc.gnu.org/bugzilla/>
2007-04-23 11:48 ` [Bug tree-optimization/15353] [tree-ssa] Merge two "if"s if one subsumes the other rguenth at gcc dot gnu dot org
2007-06-12 12:06 ` rguenth at gcc dot gnu dot org
2007-06-12 12:08 ` rguenth at gcc dot gnu dot org
     [not found] <bug-15353-4@http.gcc.gnu.org/bugzilla/>
2013-11-09 20:40 ` pinskia at gcc dot gnu.org
     [not found] <20040509200719.15353.kazu@gcc.gnu.org>
2005-08-10 18:57 ` law at redhat dot com
2005-08-11 11:01 ` rguenth at gcc dot gnu dot org
2005-08-11 15:43 ` law at redhat dot com
2005-08-11 15:52 ` trt at acm dot org
2005-08-11 17:29 ` law at redhat dot com
2004-05-09 20:07 [Bug optimization/15353] New: " kazu at cs dot umass dot edu
2004-05-25  0:03 ` [Bug tree-optimization/15353] " pinskia at gcc dot gnu dot org
2005-06-11 19:06 ` rguenth at gcc dot gnu dot org
2005-06-11 19:16 ` 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).