public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/13799] New: [tree-ssa] consecutive stores to static vars not removed
@ 2004-01-21 20:32 dann at godzilla dot ics dot uci dot edu
  2004-01-21 21:46 ` [Bug optimization/13799] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2004-01-21 20:32 UTC (permalink / raw)
  To: gcc-bugs

int foo11 (int c)
{
  static int local1, local2;
  local1 = 0;
  local2 += c;
  local1 = 2;
  local2++;
  return local1 + local2;
}



There should be 1 store to local2, local1 should be eliminated.

the .optimized dump:

foo11 (c)
{
  static int local2;
  static int local1;
  int T.7;

<bb 0>:
  local1 = 0;
  local2 = c;
  local1 = 2;
  T.7 = c + 1;
  local2 = T.7;
  return T.7 + 2;

}

-- 
           Summary: [tree-ssa] consecutive stores to static vars not removed
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dann at godzilla dot ics dot uci dot edu
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug optimization/13799] [tree-ssa] consecutive stores to static vars not removed
  2004-01-21 20:32 [Bug optimization/13799] New: [tree-ssa] consecutive stores to static vars not removed dann at godzilla dot ics dot uci dot edu
@ 2004-01-21 21:46 ` pinskia at gcc dot gnu dot org
  2004-02-16 22:05 ` law at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-21 21:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-21 21:46 -------
Confirmed, PTA does not help either.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |pessimizes-code
   Last reconfirmed|0000-00-00 00:00:00         |2004-01-21 21:46:20
               date|                            |
   Target Milestone|---                         |tree-ssa


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


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

* [Bug optimization/13799] [tree-ssa] consecutive stores to static vars not removed
  2004-01-21 20:32 [Bug optimization/13799] New: [tree-ssa] consecutive stores to static vars not removed dann at godzilla dot ics dot uci dot edu
  2004-01-21 21:46 ` [Bug optimization/13799] " pinskia at gcc dot gnu dot org
@ 2004-02-16 22:05 ` law at gcc dot gnu dot org
  2004-02-16 22:11 ` falk dot hueffner at student dot uni-tuebingen dot de
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: law at gcc dot gnu dot org @ 2004-02-16 22:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From law at gcc dot gnu dot org  2004-02-16 22:05 -------
Totally eliminating local1 is for real world code a waste of time -- what would be
the point in having the static variable if it was always set before it was used.

While it would be possible to detect that local1 is 100% totally useless, it's
simply not work the programming effort or compile-time cost.

Now it certainly is worth the cost to eliminate the clearly dead "local1 = 0"
statement as well as the "local2 += c" statement, which is precisely what the
DSE code I checked in earlier today does.

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


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


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

* [Bug optimization/13799] [tree-ssa] consecutive stores to static vars not removed
  2004-01-21 20:32 [Bug optimization/13799] New: [tree-ssa] consecutive stores to static vars not removed dann at godzilla dot ics dot uci dot edu
  2004-01-21 21:46 ` [Bug optimization/13799] " pinskia at gcc dot gnu dot org
  2004-02-16 22:05 ` law at gcc dot gnu dot org
@ 2004-02-16 22:11 ` falk dot hueffner at student dot uni-tuebingen dot de
  2005-04-17 23:52 ` [Bug rtl-optimization/13799] " pinskia at gcc dot gnu dot org
  2005-04-17 23:52 ` [Bug tree-optimization/13799] " pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: falk dot hueffner at student dot uni-tuebingen dot de @ 2004-02-16 22:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From falk dot hueffner at student dot uni-tuebingen dot de  2004-02-16 22:11 -------
Subject: Re:  [tree-ssa] consecutive stores to static vars not removed

"law at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

> Totally eliminating local1 is for real world code a waste of time --
> what would be the point in having the static variable if it was
> always set before it was used.

This occurs a lot in the output of f2c or similar tools.



-- 


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


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

* [Bug rtl-optimization/13799] [tree-ssa] consecutive stores to static vars not removed
  2004-01-21 20:32 [Bug optimization/13799] New: [tree-ssa] consecutive stores to static vars not removed dann at godzilla dot ics dot uci dot edu
                   ` (2 preceding siblings ...)
  2004-02-16 22:11 ` falk dot hueffner at student dot uni-tuebingen dot de
@ 2005-04-17 23:52 ` pinskia at gcc dot gnu dot org
  2005-04-17 23:52 ` [Bug tree-optimization/13799] " pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-17 23:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-17 23:51 -------
Actually DSE did not fix this and there is a reason, the tree DSE does not understand V_MUST_DEF.

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


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


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

* [Bug tree-optimization/13799] [tree-ssa] consecutive stores to static vars not removed
  2004-01-21 20:32 [Bug optimization/13799] New: [tree-ssa] consecutive stores to static vars not removed dann at godzilla dot ics dot uci dot edu
                   ` (3 preceding siblings ...)
  2005-04-17 23:52 ` [Bug rtl-optimization/13799] " pinskia at gcc dot gnu dot org
@ 2005-04-17 23:52 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-17 23:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-17 23:52 -------
But that makes it a dup of bug 18880.

*** This bug has been marked as a duplicate of 18880 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
          Component|rtl-optimization            |tree-optimization
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2005-04-17 23:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-21 20:32 [Bug optimization/13799] New: [tree-ssa] consecutive stores to static vars not removed dann at godzilla dot ics dot uci dot edu
2004-01-21 21:46 ` [Bug optimization/13799] " pinskia at gcc dot gnu dot org
2004-02-16 22:05 ` law at gcc dot gnu dot org
2004-02-16 22:11 ` falk dot hueffner at student dot uni-tuebingen dot de
2005-04-17 23:52 ` [Bug rtl-optimization/13799] " pinskia at gcc dot gnu dot org
2005-04-17 23:52 ` [Bug tree-optimization/13799] " 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).