This is the mail archive of the 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]

Aliasing not honouring const?


I don't know if I'm reading the tree-dumps right, but for

int loc_test(void)
        const Loc<2> dX(1, 0);
        Loc<2> k(0, 1);
        return k[0].first()+dX[0].first();

where Loc<2> is a suitable class which maintains an array of
2 integers and can not be SRAed;  we get for the optimized
tree dump:

  # BLOCK 0
  # PRED: ENTRY [100.0%]  (fallthru,exec)
  D.34908 = (struct Loc<1>D.31246 *)
  #   dXD.32225_398 = V_MAY_DEF <dXD.32225_313>;
  #   kD.32228_397 = V_MAY_DEF <kD.32228_312>;
  *&(&D.34908->D.31703)->D.31666.domain_mD.31632 = 1;
  #   dXD.32225_367 = V_MAY_DEF <dXD.32225_398>;
  #   kD.32228_366 = V_MAY_DEF <kD.32228_397>;
  *&(&(D.34908 + 4B)->D.31703)->D.31666.domain_mD.31632 = 0;
  D.35049 = (struct Loc<1>D.31246 *)
  thisD.35059 = &D.35049->D.31703;
  #   dXD.32225_59 = V_MAY_DEF <dXD.32225_367>;
  #   kD.32228_343 = V_MAY_DEF <kD.32228_366>;
  *&thisD.35059->D.31666.domain_mD.31632 = 0;
  #   dXD.32225_61 = V_MAY_DEF <dXD.32225_59>;
  #   kD.32228_173 = V_MAY_DEF <kD.32228_343>;
  *&(&(D.35049 + 4B)->D.31703)->D.31666.domain_mD.31632 = 1;
  D.35164 = (struct Loc<1>D.31246 *)
  return thisD.35059->D.31666.domain_mD.31632 +
  # SUCC: EXIT [100.0%]

does this mean that the optimizers think that the initialization
of k and dX may interfere which each other?  Can't we do better
just because we do not do struct or array aliasing, or is this
some more low-hanging fruit?

Thanks for any hints!

Richard Guenther <richard dot guenther at uni-tuebingen dot de>

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