[Bug rtl-optimization/63191] [4.8/4.9/5 Regression] 32-bit gcc uses excessive memory during dead store elimination with -fPIC

steven at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Apr 7 21:39:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63191

--- Comment #7 from Steven Bosscher <steven at gcc dot gnu.org> ---
(In reply to Steven Bosscher from comment #6)
> Now let's see if I can come up with a more reasonable test case...

Like so:

----- 8< -----
typedef int X;

struct Z {
    Z(const X* x1, X x2, X x3) :
      x1_(x1), x2_(x2), x3_(x3) {}
    const X* x1_;
    X x2_;
    X x3_;
};

#undef X____1
#undef X___10
#undef X__100
#undef X_1000
#undef X10000
#define X____1(N) \
  static const X Xs##N[] = {};
#define X___10(N) \
  X____1(N##0) X____1(N##1) X____1(N##2) X____1(N##3) X____1(N##4) \
  X____1(N##5) X____1(N##6) X____1(N##7) X____1(N##8) X____1(N##9)
#define X__100(N) \
  X___10(N##0) X___10(N##1) X___10(N##2) X___10(N##3) X___10(N##4) \
  X___10(N##5) X___10(N##6) X___10(N##7) X___10(N##8) X___10(N##9)
#define X_1000(N) \
  X__100(N##0) X__100(N##1) X__100(N##2) X__100(N##3) X__100(N##4) \
  X__100(N##5) X__100(N##6) X__100(N##7) X__100(N##8) X__100(N##9)
#define X10000(N) \
  X_1000(N##0) X_1000(N##1) X_1000(N##2) X_1000(N##3) X_1000(N##4) \
  X_1000(N##5) X_1000(N##6) X_1000(N##7) X_1000(N##8) X_1000(N##9)

X10000(0)

#undef Z____1
#undef Z___10
#undef Z__100
#undef Z_1000
#undef Z10000
#define Z____1(N,I,J) \
  Z(Xs##N,1,1),
#define Z___10(N) \
  Z____1(N##0,1,1) Z____1(N##0,1,1) \
  Z____1(N##0,1,1) Z____1(N##1,2,1) \
  Z____1(N##0,1,1) Z____1(N##2,1,2) \
  Z____1(N##0,1,1) Z____1(N##3,6,3) \
  Z____1(N##0,1,1) Z____1(N##4,7,2) \
  Z____1(N##0,1,1) Z____1(N##5,1,3) \
  Z____1(N##0,1,1) Z____1(N##6,5,9) \
  Z____1(N##0,1,1) Z____1(N##7,7,1) \
  Z____1(N##0,1,1) Z____1(N##8,3,3) \
  Z____1(N##0,1,1) Z____1(N##9,2,2)
#define Z__100(N) \
  Z___10(N##0) Z___10(N##1) Z___10(N##2) Z___10(N##3) Z___10(N##4) \
  Z___10(N##5) Z___10(N##6) Z___10(N##7) Z___10(N##8) Z___10(N##9)
#define Z_1000(N) \
  Z__100(N##0) Z__100(N##1) Z__100(N##2) Z__100(N##3) Z__100(N##4) \
  Z__100(N##5) Z__100(N##6) Z__100(N##7) Z__100(N##8) Z__100(N##9)
#define Z10000(N) \
  Z_1000(N##0) // Z_1000(N##1) Z_1000(N##2) Z_1000(N##3) Z_1000(N##4) \
  // Z_1000(N##5) Z_1000(N##6) Z_1000(N##7) Z_1000(N##8) Z_1000(N##9)

static const X XsLast[] = {};
static const Z Zs[] = { Z10000(0) Z(XsLast,1,1) };

const Z* getzs() {
    return &Zs[0];
}

----- 8< -----

exploding in DSE:
 dead store elim1        :  45.34 (15%) usr   0.19 (28%) sys  45.53 (15%) wall
1016985 kB (45%) ggc



More information about the Gcc-bugs mailing list