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

Aliasing not honouring const?


Hi!

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.D.31819.D.31775.domain_mD.31604.bufferD.31617;
  #   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 *)
&kD.32228.D.31819.D.31775.domain_mD.31604.bufferD.31617;
  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 *)
&dXD.32225.D.31819.D.31775.domain_mD.31604.bufferD.31617;
  return thisD.35059->D.31666.domain_mD.31632 +
(&D.35164->D.31703)->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.

--
Richard Guenther <richard dot guenther at uni-tuebingen dot de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/


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