public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/20913] New: copy-prop does not fold conditionals
@ 2005-04-09  3:53 kazu at cs dot umass dot edu
  2005-04-11  6:40 ` [Bug tree-optimization/20913] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-04-09  3:53 UTC (permalink / raw)
  To: gcc-bugs

Consider:

int
foo (int a, int b, int c, int d)
{
  int x, y;

  b = a;
  if (a == b)
    x = c;
  else
    x = d;

  if (x == c)
    return a;
  else
    return b;
}

Run ./cc1 -quiet -O2 -fno-tree-dominator-opts.

Here is the result.

foo (a, b, c, d)
{
  int y;
  int x;
  int D.1145;

<bb 0>:
  b_4 = a_3;
  x_11 = c_5;

  # x_1 = PHI <c_5(0)>;
<L2>:;
  if (x_1 == c_5) goto <L3>; else goto <L4>;

<L3>:;
  a_8 = a_3;
  goto <bb 4> (<L5>);

<L4>:;
  b_7 = a_3;

  # a_2 = PHI <a_3(2), a_3(3)>;
<L5>:;
  return a_3;

}

Note that x == c, but the copy-prop doesn't fold the "if" statement.

This is because find_taken_edge no longer folds conditionals.

-- 
           Summary: copy-prop does not fold conditionals
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: kazu at cs dot umass dot edu
        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=20913


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

* [Bug tree-optimization/20913] copy-prop does not fold conditionals
  2005-04-09  3:53 [Bug tree-optimization/20913] New: copy-prop does not fold conditionals kazu at cs dot umass dot edu
@ 2005-04-11  6:40 ` pinskia at gcc dot gnu dot org
  2005-04-12 23:14 ` kazu at cs dot umass dot edu
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-11  6:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-11 06:40 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-04-11 06:40:52
               date|                            |
            Version|unknown                     |4.1.0


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


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

* [Bug tree-optimization/20913] copy-prop does not fold conditionals
  2005-04-09  3:53 [Bug tree-optimization/20913] New: copy-prop does not fold conditionals kazu at cs dot umass dot edu
  2005-04-11  6:40 ` [Bug tree-optimization/20913] " pinskia at gcc dot gnu dot org
@ 2005-04-12 23:14 ` kazu at cs dot umass dot edu
  2005-04-13 14:57 ` kazu at cs dot umass dot edu
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-04-12 23:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2005-04-12 23:13 -------
*** Bug 20762 has been marked as a duplicate of this bug. ***

-- 


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


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

* [Bug tree-optimization/20913] copy-prop does not fold conditionals
  2005-04-09  3:53 [Bug tree-optimization/20913] New: copy-prop does not fold conditionals kazu at cs dot umass dot edu
  2005-04-11  6:40 ` [Bug tree-optimization/20913] " pinskia at gcc dot gnu dot org
  2005-04-12 23:14 ` kazu at cs dot umass dot edu
@ 2005-04-13 14:57 ` kazu at cs dot umass dot edu
  2005-04-13 15:29 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-04-13 14:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2005-04-13 14:56 -------
Patch posted:
http://gcc.gnu.org/ml/gcc-patches/2005-04/msg01457.html


-- 


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


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

* [Bug tree-optimization/20913] copy-prop does not fold conditionals
  2005-04-09  3:53 [Bug tree-optimization/20913] New: copy-prop does not fold conditionals kazu at cs dot umass dot edu
                   ` (2 preceding siblings ...)
  2005-04-13 14:57 ` kazu at cs dot umass dot edu
@ 2005-04-13 15:29 ` cvs-commit at gcc dot gnu dot org
  2005-04-13 15:33 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-04-13 15:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-04-13 15:29 -------
Subject: Bug 20913

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	kazu@gcc.gnu.org	2005-04-13 15:28:55

Modified files:
	gcc            : ChangeLog tree-ssa-copy.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg/tree-ssa: pr20913.c 

Log message:
	gcc/
	PR tree-optimization/20913
	* tree-ssa-copy.c (copy_prop_visit_cond_stmt): Fold COND_EXPR.
	
	testsuite/
	PR tree-optimization/20913
	* gcc.dg/tree-ssa/pr20913.c: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8274&r2=2.8275
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-ssa-copy.c.diff?cvsroot=gcc&r1=2.25&r2=2.26
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5337&r2=1.5338
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/tree-ssa/pr20913.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug tree-optimization/20913] copy-prop does not fold conditionals
  2005-04-09  3:53 [Bug tree-optimization/20913] New: copy-prop does not fold conditionals kazu at cs dot umass dot edu
                   ` (3 preceding siblings ...)
  2005-04-13 15:29 ` cvs-commit at gcc dot gnu dot org
@ 2005-04-13 15:33 ` cvs-commit at gcc dot gnu dot org
  2005-04-13 18:14 ` kazu at cs dot umass dot edu
  2005-04-13 18:16 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-04-13 15:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-04-13 15:33 -------
Subject: Bug 20913

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	kazu@gcc.gnu.org	2005-04-13 15:33:18

Modified files:
	gcc            : ChangeLog tree-vrp.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg/tree-ssa: pr20702.c 

Log message:
	gcc/
	PR tree-optimization/20913
	* tree-ssa-copy.c (copy_prop_visit_cond_stmt): Fold COND_EXPR.
	
	testsuite/
	PR tree-optimization/20913
	* gcc.dg/tree-ssa/pr20913.c: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8275&r2=2.8276
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-vrp.c.diff?cvsroot=gcc&r1=2.5&r2=2.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5338&r2=1.5339
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/tree-ssa/pr20702.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug tree-optimization/20913] copy-prop does not fold conditionals
  2005-04-09  3:53 [Bug tree-optimization/20913] New: copy-prop does not fold conditionals kazu at cs dot umass dot edu
                   ` (4 preceding siblings ...)
  2005-04-13 15:33 ` cvs-commit at gcc dot gnu dot org
@ 2005-04-13 18:14 ` kazu at cs dot umass dot edu
  2005-04-13 18:16 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-04-13 18:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2005-04-13 18:14 -------
Just checked in a patch.


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


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


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

* [Bug tree-optimization/20913] copy-prop does not fold conditionals
  2005-04-09  3:53 [Bug tree-optimization/20913] New: copy-prop does not fold conditionals kazu at cs dot umass dot edu
                   ` (5 preceding siblings ...)
  2005-04-13 18:14 ` kazu at cs dot umass dot edu
@ 2005-04-13 18:16 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-13 18:16 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.1.0


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


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

end of thread, other threads:[~2005-04-13 18:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-09  3:53 [Bug tree-optimization/20913] New: copy-prop does not fold conditionals kazu at cs dot umass dot edu
2005-04-11  6:40 ` [Bug tree-optimization/20913] " pinskia at gcc dot gnu dot org
2005-04-12 23:14 ` kazu at cs dot umass dot edu
2005-04-13 14:57 ` kazu at cs dot umass dot edu
2005-04-13 15:29 ` cvs-commit at gcc dot gnu dot org
2005-04-13 15:33 ` cvs-commit at gcc dot gnu dot org
2005-04-13 18:14 ` kazu at cs dot umass dot edu
2005-04-13 18: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).