This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug optimization/14814] New: Dead stores not eliminated


The dead stores to the stack in foo are not eliminated until the RTL optimizers.
This is derived from the eon SPECmark, and similar constructs are common in C++.
13952 is related, but not the same.

class YY { public:
  YY(const YY &v) { e[0] = v.e[0]; e[1] = v.e[1]; e[2] = v.e[2]; }
  double &y() { return e[1]; }
  double e[3];  };

class XX { public:
  YY direction() const { return v; }
  YY v;  };

int foo(XX& r) {
  if (r.direction().y() < 0.000001) return 0;
  return 1; }

Here is a C variant (from Andrew Pinski) where the RTL optimizers aren't good enough:

struct YY {
  double e[3];  };

static inline double *y(struct YY* this_1) { return &this_1->e[1]; }

struct XX {
  struct YY v;
 };

static inline struct YY direction (const struct  XX* this_1) { return this_1->v;}

int foo(const struct XX* r) {
  struct YY t = direction(r);
  if (*y(&t) < 0.000001) return 0;
  return 1;
}

-- 
           Summary: Dead stores not eliminated
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: optimization
        AssignedTo: dnovillo at gcc dot gnu dot org
        ReportedBy: dalej at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-apple-darwin7.2.0
  GCC host triplet: powerpc-apple-darwin7.2.0
                    powerpc-apple-darwin7.2.0
GCC target triplet: powerpc-apple-darwin7.2.0


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]