public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/89567] [missed-optimization] Should not be initializing unused struct parameter members
       [not found] <bug-89567-4@http.gcc.gnu.org/bugzilla/>
@ 2024-03-15  3:25 ` pinskia at gcc dot gnu.org
  2024-03-15 18:21 ` eyalroz1 at gmx dot com
  2024-03-15 18:39 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-15  3:25 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
IPA-SRA does handle this if the function is static.

Also mod-ref handles this if the function takes a pointer instead of a struct.
Aka:
```
 struct two_ints { int x, y; };

  __attribute__((noinline)) int foo2(struct two_ints *s)
  {
    return s->x;
  }

  int bar2(int* a)
  {
    struct two_ints ti = { a[5], a[10] };
    int b = foo2(&ti);
    return b * b;
  }
```

The store to ti.x is only there now.

I am think this can be closed as fixed ...

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

* [Bug ipa/89567] [missed-optimization] Should not be initializing unused struct parameter members
       [not found] <bug-89567-4@http.gcc.gnu.org/bugzilla/>
  2024-03-15  3:25 ` [Bug ipa/89567] [missed-optimization] Should not be initializing unused struct parameter members pinskia at gcc dot gnu.org
@ 2024-03-15 18:21 ` eyalroz1 at gmx dot com
  2024-03-15 18:39 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: eyalroz1 at gmx dot com @ 2024-03-15 18:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Eyal Rozenberg <eyalroz1 at gmx dot com> ---
(In reply to Andrew Pinski from comment #6)
> I am think this can be closed as fixed ...

Well, my example no longer generates two loads. However


> IPA-SRA does handle this if the function is static.
> 
> Also mod-ref handles this if the function takes a pointer instead of a
> struct.

are both not the case for my example.

So, while I don't understand know why this works now, it does, and I suppose
you can close this.

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

* [Bug ipa/89567] [missed-optimization] Should not be initializing unused struct parameter members
       [not found] <bug-89567-4@http.gcc.gnu.org/bugzilla/>
  2024-03-15  3:25 ` [Bug ipa/89567] [missed-optimization] Should not be initializing unused struct parameter members pinskia at gcc dot gnu.org
  2024-03-15 18:21 ` eyalroz1 at gmx dot com
@ 2024-03-15 18:39 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-15 18:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
For the non-static case, IPA-SRA has:
```
Summary for node int foo2(two_ints)/0:
  Returns value
  Descriptor for parameter 0:
    param_size_limit: 8, size_reached: 4
    * Access to unit offset: 0, unit size: 4, type: int, alias_ptr_type: int *,
certain


...
Function int foo2(two_ints)/0 disqualified because it cannot be made local.
```

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

end of thread, other threads:[~2024-03-15 18:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-89567-4@http.gcc.gnu.org/bugzilla/>
2024-03-15  3:25 ` [Bug ipa/89567] [missed-optimization] Should not be initializing unused struct parameter members pinskia at gcc dot gnu.org
2024-03-15 18:21 ` eyalroz1 at gmx dot com
2024-03-15 18:39 ` pinskia 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).