Bug 35361 - Missing IPA DCE and DSE
Summary: Missing IPA DCE and DSE
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.3.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
Depends on:
Blocks:
 
Reported: 2008-02-25 05:23 UTC by davidxl
Modified: 2008-02-25 11:39 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-02-25 11:39:30


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description davidxl 2008-02-25 05:23:51 UTC
// David Li

Gcc is solid in performing dead function elimination and dead variable elimination for statics. It handles cases when a dead variable is referenced (via initializer) by other dead variables pretty well. The missing opportunities noticed is that it fails to discover dead stores to static variables where are never used -- thus missing the dead variable elimination ...

Example 1:

static int s;
static int* p =&s;

int foo()
{
   p = 0;      // Dead, not eliminated
}


Example 2:

static int g = 10;
static int* gp = &g;

int foo()
{
  gp = 0;      // Dead store
  return g;    // should be const proped
}
Comment 1 Richard Biener 2008-02-25 11:39:30 UTC
It looks like this needs IPA DCE/DSE.