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

Re: Patch: {tree-ssa] Fixes re multiple type nodes from IMA


I feel like this is the wrong approach. Having a language independent optimizations which
do not depend on language information is one of things which the tree-ssa got right, well
the other thing is target independence.


I really think the front-end should not be lying to the middle-end about types at all, all
the fix up to the types should happen in the front-end before getting to the middle-end.


Also there huge problems right now in the C++ front-end because of the way it handles types
and such so it can generate trees which look like this:




void copystruct1(teststruct) (param)
{
  struct
  {
    double d;
    char f1;
  } * local.0;
  struct
  {
    double d;
    char f1;
  } * param.1;
  char T.2;

  {
    struct teststruct local;

    param.f1 = 0;
    local.0 = (struct
    {
      double d;
      char f1;
    } *)&local;
    param.1 = (struct
    {
      double d;
      char f1;
    } *)&param;
    *local.0 = *param.1;
    {
      T.2 = local.f1;
      if (T.2 != 0)
        {
          {
            link_error ();
          }
        }
      else
        {

        }
    }
  }
}


Which makes optimizations like SRA hard. C++ should have fixed it up so it would look like this instead:

struct new_type
  {
    double d;
    char f1;
  };

void copystruct1(teststruct) (param)
{
  new_type* local.0;
  new_type * param.1;
  char T.2;

  {
    struct new_type local;

    param.f1 = 0;
    local.0 = &local;
    param.1 = &param;
    *local.0 = *param.1;
    {
      T.2 = local.f1;
      if (T.2 != 0)
        {
          {
            link_error ();
          }
        }
      else
        {

        }
    }
  }
}

Then there is no issue with inheritance. This should also happen with the C front-end
when doing IMA and such also.


This example comes from PR 13954.

Thanks,
Andrew Pinski


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