public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/110379] New: Unnecessary copies after early opts
@ 2023-06-23 17:07 hubicka at gcc dot gnu.org
  2023-06-23 19:54 ` [Bug middle-end/110379] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: hubicka at gcc dot gnu.org @ 2023-06-23 17:07 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug middle-end/110379] Unnecessary copies after early opts
  2023-06-23 17:07 [Bug middle-end/110379] New: Unnecessary copies after early opts hubicka at gcc dot gnu.org
@ 2023-06-23 19:54 ` pinskia at gcc dot gnu.org
  2023-06-23 19:57 ` pinskia at gcc dot gnu.org
  2023-06-27  9:40 ` hubicka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-23 19:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
IIRC this is needed for __builtin_object_size still ....

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug middle-end/110379] Unnecessary copies after early opts
  2023-06-23 17:07 [Bug middle-end/110379] New: Unnecessary copies after early opts hubicka at gcc dot gnu.org
  2023-06-23 19:54 ` [Bug middle-end/110379] " pinskia at gcc dot gnu.org
@ 2023-06-23 19:57 ` pinskia at gcc dot gnu.org
  2023-06-27  9:40 ` hubicka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-23 19:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Plus this is basically the same as the following C code:
```
struct a
{
        int t;
};
void foo (struct a *);

struct b
{
        struct a f;
};
void test(struct b *t)
{
        foo(&t->f);
}
```

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug middle-end/110379] Unnecessary copies after early opts
  2023-06-23 17:07 [Bug middle-end/110379] New: Unnecessary copies after early opts hubicka at gcc dot gnu.org
  2023-06-23 19:54 ` [Bug middle-end/110379] " pinskia at gcc dot gnu.org
  2023-06-23 19:57 ` pinskia at gcc dot gnu.org
@ 2023-06-27  9:40 ` hubicka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: hubicka at gcc dot gnu.org @ 2023-06-27  9:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
I thought that ADDR_EXPR of refenence is just fancy way to represent NOP_EXPR
or POINTER_PLUS in today gimple. How that affects builtin_object_size? :)

However I think ipa-sra will eventually need to handel also ADDR_EXPR that
correspnds to non-zero offset

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-06-27  9:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-23 17:07 [Bug middle-end/110379] New: Unnecessary copies after early opts hubicka at gcc dot gnu.org
2023-06-23 19:54 ` [Bug middle-end/110379] " pinskia at gcc dot gnu.org
2023-06-23 19:57 ` pinskia at gcc dot gnu.org
2023-06-27  9:40 ` hubicka at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).