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

            Bug ID: 110379
           Summary: Unnecessary copies after early opts
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hubicka at gcc dot gnu.org
  Target Milestone: ---

Following testcase:
class a 
{
        public:
        int b;
};
void foo (class a *);
class b: public a
{
        int test();
};
int b::test()
{
        foo (this);
        return 0;
}

produces:
int b::test (struct b * const this)
{
  struct a * _1;

  <bb 2> [local count: 1073741824]:
  _1 = &this_2(D)->D.2773;
  foo (_1);
  return 0;
}

I think it is equivalent to


int b::test (struct b * const this)
{
  <bb 2> [local count: 1073741824]:
  foo (this);
  return 0;
}

Which would save statement and confuse less ipa-sra and ipa-prop.

Reply via email to