public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/17671] New: PHI-OPT is not smart enough
@ 2004-09-25 23:27 pinskia at gcc dot gnu dot org
  2004-09-25 23:28 ` [Bug tree-optimization/17671] " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-25 23:27 UTC (permalink / raw)
  To: gcc-bugs

Here is an example of where PHI-OPT could be smarter and do top down instead of bottom up.  
Looking at COND_EXPR instead of looking at the PHI nodes
int f(int a, int b)
{
  if (a == 0)
   return 0;
  if (a != b)
   return a;
 return a;
}

-- 
           Summary: PHI-OPT is not smart enough
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, TREE
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug tree-optimization/17671] PHI-OPT is not smart enough
  2004-09-25 23:27 [Bug tree-optimization/17671] New: PHI-OPT is not smart enough pinskia at gcc dot gnu dot org
@ 2004-09-25 23:28 ` pinskia at gcc dot gnu dot org
  2004-09-28 22:42 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-25 23:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-25 23:28 -------
I am going to take a stab at this for 4.1.0.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-09-25 23:28:37
               date|                            |
   Target Milestone|---                         |4.1.0


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


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

* [Bug tree-optimization/17671] PHI-OPT is not smart enough
  2004-09-25 23:27 [Bug tree-optimization/17671] New: PHI-OPT is not smart enough pinskia at gcc dot gnu dot org
  2004-09-25 23:28 ` [Bug tree-optimization/17671] " pinskia at gcc dot gnu dot org
@ 2004-09-28 22:42 ` pinskia at gcc dot gnu dot org
  2004-09-29  3:44 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-28 22:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-28 22:42 -------
Here is another example (which shows up in PR8361) (plus after my patch we actually optimize it better 
than before):
_Bool f1(_Bool a, _Bool b)
{
  if (a)
   {
     if (b)
      return 1;
     else
      return 0;
   }
  return 0;
}

-- 


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


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

* [Bug tree-optimization/17671] PHI-OPT is not smart enough
  2004-09-25 23:27 [Bug tree-optimization/17671] New: PHI-OPT is not smart enough pinskia at gcc dot gnu dot org
  2004-09-25 23:28 ` [Bug tree-optimization/17671] " pinskia at gcc dot gnu dot org
  2004-09-28 22:42 ` pinskia at gcc dot gnu dot org
@ 2004-09-29  3:44 ` pinskia at gcc dot gnu dot org
  2004-09-29 17:07 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-29  3:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-29 03:44 -------
Here is another example which I already with my patch.
int f(int a, int b, int c)
{
  if (c == 0) goto temp;
  if (a == 0)
   return 0;
temp:
  if (a == b)
   return a;
 return a;
}

-- 


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


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

* [Bug tree-optimization/17671] PHI-OPT is not smart enough
  2004-09-25 23:27 [Bug tree-optimization/17671] New: PHI-OPT is not smart enough pinskia at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-09-29  3:44 ` pinskia at gcc dot gnu dot org
@ 2004-09-29 17:07 ` pinskia at gcc dot gnu dot org
  2004-10-04 12:45 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-29 17:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-29 17:07 -------
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02959.html>.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


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


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

* [Bug tree-optimization/17671] PHI-OPT is not smart enough
  2004-09-25 23:27 [Bug tree-optimization/17671] New: PHI-OPT is not smart enough pinskia at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-09-29 17:07 ` pinskia at gcc dot gnu dot org
@ 2004-10-04 12:45 ` pinskia at gcc dot gnu dot org
  2004-10-08  1:41 ` cvs-commit at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-04 12:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-04 12:45 -------
Posted a new patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-10/msg00221.html>.

-- 


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


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

* [Bug tree-optimization/17671] PHI-OPT is not smart enough
  2004-09-25 23:27 [Bug tree-optimization/17671] New: PHI-OPT is not smart enough pinskia at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-10-04 12:45 ` pinskia at gcc dot gnu dot org
@ 2004-10-08  1:41 ` cvs-commit at gcc dot gnu dot org
  2004-10-08  2:49 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-10-08  1:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-10-08 01:41 -------
Subject: Bug 17671

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	tree-cleanup-branch
Changes by:	pinskia@gcc.gnu.org	2004-10-08 01:41:47

Modified files:
	gcc            : ChangeLog.tcb tree-ssa-phiopt.c 
	gcc/testsuite  : ChangeLog.tcb 
Added files:
	gcc/testsuite/gcc.dg/tree-ssa: phi-opt-1.c phi-opt-2.c 
	                               phi-opt-3.c phi-opt-4.c 

Log message:
	2004-10-07  Andrew Pinski  <pinskia@physics.uc.edu>
	
	PR tree-opt/17671
	* tree-ssa-phiopt.c (tree_ssa_phiopt): Rewrite so we base the
	bbs on the COND_EXPR instead of the PHI_NODEs.
	(candidate_bb_for_phi_optimization): Remove.
	(replace_phi_with_stmt): Rename to ...
	(replace_phi_edge_with_variable): this and change so that we
	replace the phi argument instead of removing the PHI.
	(conditional_replacement): Change so we deal with PHI with more
	than two arguments.
	(value_replacement): Likewise.
	(abs_replacement): Likewise.
	
	2004-10-07  Andrew Pinski  <pinskia@physics.uc.edu>
	
	PR tree-opt/17671
	* gcc.dg/tree-ssa/phi-opt-[1-4].c: New tests.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.tcb.diff?cvsroot=gcc&only_with_tag=tree-cleanup-branch&r1=1.1.2.2&r2=1.1.2.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-ssa-phiopt.c.diff?cvsroot=gcc&only_with_tag=tree-cleanup-branch&r1=2.13.2.2&r2=2.13.2.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.tcb.diff?cvsroot=gcc&only_with_tag=tree-cleanup-branch&r1=1.1.2.1&r2=1.1.2.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-1.c.diff?cvsroot=gcc&only_with_tag=tree-cleanup-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-2.c.diff?cvsroot=gcc&only_with_tag=tree-cleanup-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-3.c.diff?cvsroot=gcc&only_with_tag=tree-cleanup-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-4.c.diff?cvsroot=gcc&only_with_tag=tree-cleanup-branch&r1=NONE&r2=1.1.2.1



-- 


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


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

* [Bug tree-optimization/17671] PHI-OPT is not smart enough
  2004-09-25 23:27 [Bug tree-optimization/17671] New: PHI-OPT is not smart enough pinskia at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2004-10-08  1:41 ` cvs-commit at gcc dot gnu dot org
@ 2004-10-08  2:49 ` pinskia at gcc dot gnu dot org
  2005-03-06 19:52 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-08  2:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-08 02:49 -------
This is fixed on the tcb branch which means that it should get merged once 4.0 branches.

-- 


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


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

* [Bug tree-optimization/17671] PHI-OPT is not smart enough
  2004-09-25 23:27 [Bug tree-optimization/17671] New: PHI-OPT is not smart enough pinskia at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2004-10-08  2:49 ` pinskia at gcc dot gnu dot org
@ 2005-03-06 19:52 ` pinskia at gcc dot gnu dot org
  2005-03-08  0:40 ` cvs-commit at gcc dot gnu dot org
  2005-03-08  0:41 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-06 19:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-06 19:52 -------
Patch for 4.1.0 was posted here: <http://gcc.gnu.org/ml/gcc-patches/2005-03/msg00548.html>.

-- 


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


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

* [Bug tree-optimization/17671] PHI-OPT is not smart enough
  2004-09-25 23:27 [Bug tree-optimization/17671] New: PHI-OPT is not smart enough pinskia at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2005-03-06 19:52 ` pinskia at gcc dot gnu dot org
@ 2005-03-08  0:40 ` cvs-commit at gcc dot gnu dot org
  2005-03-08  0:41 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-03-08  0:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-03-08 00:40 -------
Subject: Bug 17671

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	pinskia@gcc.gnu.org	2005-03-08 00:40:33

Modified files:
	gcc            : ChangeLog tree-ssa-phiopt.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg/tree-ssa: phi-opt-1.c phi-opt-2.c 
	                               phi-opt-3.c phi-opt-4.c 

Log message:
	2005-03-06  Andrew Pinski  <pinskia@physics.uc.edu>
	
	PR tree-opt/17671
	* tree-ssa-phiopt.c (tree_ssa_phiopt): Rewrite so we base the
	bbs on the COND_EXPR instead of the PHI_NODEs.
	(candidate_bb_for_phi_optimization): Remove.
	(replace_phi_with_stmt): Rename to ...
	(replace_phi_edge_with_variable): this and change so that we
	replace the phi argument instead of removing the PHI.
	(conditional_replacement): Change so we deal with PHI with more
	than two arguments.
	(value_replacement): Likewise.
	(abs_replacement): Likewise.
	
	2005-03-06  Andrew Pinski  <pinskia@physics.uc.edu>
	
	PR tree-opt/17671
	* gcc.dg/tree-ssa/phi-opt-[1-4].c: New tests.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.7716&r2=2.7717
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-ssa-phiopt.c.diff?cvsroot=gcc&r1=2.20&r2=2.21
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5120&r2=1.5121
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-1.c.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-2.c.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-3.c.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-4.c.diff?cvsroot=gcc&r1=1.1&r2=1.2



-- 


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


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

* [Bug tree-optimization/17671] PHI-OPT is not smart enough
  2004-09-25 23:27 [Bug tree-optimization/17671] New: PHI-OPT is not smart enough pinskia at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2005-03-08  0:40 ` cvs-commit at gcc dot gnu dot org
@ 2005-03-08  0:41 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-08  0:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-08 00:41 -------
Fixed.

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


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


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

end of thread, other threads:[~2005-03-08  0:41 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-25 23:27 [Bug tree-optimization/17671] New: PHI-OPT is not smart enough pinskia at gcc dot gnu dot org
2004-09-25 23:28 ` [Bug tree-optimization/17671] " pinskia at gcc dot gnu dot org
2004-09-28 22:42 ` pinskia at gcc dot gnu dot org
2004-09-29  3:44 ` pinskia at gcc dot gnu dot org
2004-09-29 17:07 ` pinskia at gcc dot gnu dot org
2004-10-04 12:45 ` pinskia at gcc dot gnu dot org
2004-10-08  1:41 ` cvs-commit at gcc dot gnu dot org
2004-10-08  2:49 ` pinskia at gcc dot gnu dot org
2005-03-06 19:52 ` pinskia at gcc dot gnu dot org
2005-03-08  0:40 ` cvs-commit at gcc dot gnu dot org
2005-03-08  0:41 ` 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).