public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/14701] New: [tree-ssa] pure function optimization is not done until CSE.
@ 2004-03-24  2:17 kazu at cs dot umass dot edu
  2004-03-24  4:36 ` [Bug optimization/14701] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-03-24  2:17 UTC (permalink / raw)
  To: gcc-bugs

The second call to bar() is not removed until CSE pass (at RTL level).
This testcase was found while I was investigating those cases where CSE
simplifies conditional jumps.

/* Reduced from can_address_p() in alias.c.  */

extern int bar (int) __attribute__ ((__pure__));
extern void abort (void) __attribute__ ((__noreturn__));

void
foo (int t)
{
  if (bar (t))
    abort ();

  if (bar (t))
    abort ();
}

To give you where this thing comes from,
the original "if" statement before reduction looks like

  if (!(strchr ("<12ers", (__c)) != 0))
    tree_class_check_failed (...)

Here is the final tree.

foo (t)
{
  int T.1;
  int T.0;

<bb 0>:
  if (bar (t) != 0) goto <L0>; else goto <L1>;

<L0>:;
  abort ();

<L1>:;
  if (bar (t) != 0) goto <L2>; else goto <L3>;

<L2>:;
  abort ();

<L3>:;
  return;

}

-- 
           Summary: [tree-ssa] pure function optimization is not done until
                    CSE.
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: 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=14701


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

* [Bug optimization/14701] [tree-ssa] pure function optimization is not done until CSE.
  2004-03-24  2:17 [Bug optimization/14701] New: [tree-ssa] pure function optimization is not done until CSE kazu at cs dot umass dot edu
@ 2004-03-24  4:36 ` pinskia at gcc dot gnu dot org
  2004-04-06  0:24 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-24  4:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-24 04:36 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |pessimizes-code
   Last reconfirmed|0000-00-00 00:00:00         |2004-03-24 04:36:01
               date|                            |
   Target Milestone|---                         |tree-ssa


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


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

* [Bug optimization/14701] [tree-ssa] pure function optimization is not done until CSE.
  2004-03-24  2:17 [Bug optimization/14701] New: [tree-ssa] pure function optimization is not done until CSE kazu at cs dot umass dot edu
  2004-03-24  4:36 ` [Bug optimization/14701] " pinskia at gcc dot gnu dot org
@ 2004-04-06  0:24 ` pinskia at gcc dot gnu dot org
  2004-05-17 19:36 ` [Bug tree-optimization/14701] " steven at gcc dot gnu dot org
  2004-05-17 19:36 ` steven at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-06  0:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-06 00:24 -------
Note this SPEC has some of these in there.

-- 


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


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

* [Bug tree-optimization/14701] [tree-ssa] pure function optimization is not done until CSE.
  2004-03-24  2:17 [Bug optimization/14701] New: [tree-ssa] pure function optimization is not done until CSE kazu at cs dot umass dot edu
                   ` (2 preceding siblings ...)
  2004-05-17 19:36 ` [Bug tree-optimization/14701] " steven at gcc dot gnu dot org
@ 2004-05-17 19:36 ` steven at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-05-17 19:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-05-17 07:05 -------
copyrename2 dump: 
======================================== 
;; Function foo (foo) 
 
foo (t) 
{ 
  int T.1; 
  int T.0; 
 
  # BLOCK 0 
  # PRED: ENTRY [100.0%]  (fallthru) 
  #   VUSE <.GLOBAL_VAR_4>; 
  T.0_2 = bar (t_1); 
  if (T.0_2 != 0) goto <L0>; else goto <L1>; 
  # SUCC: 2 [33.0%]  (false) 1 [67.0%]  (true) 
 
  # BLOCK 1 
  # PRED: 0 [67.0%]  (true) 
<L0>:; 
  abort (); 
  # SUCC: 
 
  # BLOCK 2 
  # PRED: 0 [33.0%]  (false) 
<L1>:; 
  #   VUSE <.GLOBAL_VAR_4>; 
  T.1_3 = bar (t_1); 
  if (T.1_3 != 0) goto <L2>; else goto <L3>; 
  # SUCC: 4 [53.5%]  (false) 3 [46.5%]  (true) 
 
  # BLOCK 3 
  # PRED: 2 [46.5%]  (true) 
<L2>:; 
  abort (); 
  # SUCC: 
 
  # BLOCK 4 
  # PRED: 2 [53.5%]  (false) 
<L3>:; 
  return; 
  # SUCC: EXIT [100.0%] 
 
} 
======================================== 
 
dom2 dump: 
======================================== 
foo (t) 
{ 
  int T.1; 
  int T.0; 
 
  # BLOCK 0 
  # PRED: ENTRY [100.0%]  (fallthru) 
  #   VUSE <.GLOBAL_VAR_4>; 
  T.0_2 = bar (t_1); 
  if (T.0_2 != 0) goto <L0>; else goto <L1>; 
  # SUCC: 2 [33.0%]  (false) 1 [67.0%]  (true) 
 
  # BLOCK 1 
  # PRED: 0 [67.0%]  (true) 
<L0>:; 
  abort (); 
  # SUCC: 
 
  # BLOCK 2 
  # PRED: 0 [33.0%]  (false) 
<L1>:; 
  T.1_3 = 0; 
  return; 
  # SUCC: EXIT [100.0%] 
 
} 
======================================== 
 
which finally gives: 
 
foo (t) 
{ 
  int T.1; 
  int T.0; 
 
<bb 0>: 
  if (bar (t) != 0) goto <L0>; else goto <L1>; 
 
<L0>:; 
  abort (); 
 
<L1>:; 
  return; 
} 
 
So this is fixed. 
 

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


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


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

* [Bug tree-optimization/14701] [tree-ssa] pure function optimization is not done until CSE.
  2004-03-24  2:17 [Bug optimization/14701] New: [tree-ssa] pure function optimization is not done until CSE kazu at cs dot umass dot edu
  2004-03-24  4:36 ` [Bug optimization/14701] " pinskia at gcc dot gnu dot org
  2004-04-06  0:24 ` pinskia at gcc dot gnu dot org
@ 2004-05-17 19:36 ` steven at gcc dot gnu dot org
  2004-05-17 19:36 ` steven at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-05-17 19:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-05-17 06:54 -------
Not "pessimizes-code" 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|pessimizes-code, TREE       |


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


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

end of thread, other threads:[~2004-05-17  7:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-24  2:17 [Bug optimization/14701] New: [tree-ssa] pure function optimization is not done until CSE kazu at cs dot umass dot edu
2004-03-24  4:36 ` [Bug optimization/14701] " pinskia at gcc dot gnu dot org
2004-04-06  0:24 ` pinskia at gcc dot gnu dot org
2004-05-17 19:36 ` [Bug tree-optimization/14701] " steven at gcc dot gnu dot org
2004-05-17 19:36 ` steven 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).