public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/105917] New: Missed passthru jump function
@ 2022-06-10 12:14 hubicka at gcc dot gnu.org
  2022-06-10 13:00 ` [Bug ipa/105917] [10/11/12/13 regression] " hubicka at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: hubicka at gcc dot gnu.org @ 2022-06-10 12:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105917
           Summary: Missed passthru jump function
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hubicka at gcc dot gnu.org
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

In this testcase:
struct a {int a;};
struct b {int b; struct a a;};

__attribute__ ((noinline))
static int
reta (struct a a)
{
        return a.a;
}
__attribute__ ((noinline))
static int 
retba (struct b b)
{
  struct a *a = &b.a;
  return reta(*a);
}
int
main()
{
  struct b b = {1, {0}};
  return retba (b);
}

There is aggregat passthru from retba to reta but we get:

  _2 = reta (MEM[(struct a *)&b + 4B]);

Analyzing function: retba/1
  function  retba/1 parameter descriptors:
    param #0 b used undescribed_use
  Jump functions of caller  retba/1:
    callsite  retba/1 -> reta/0 :
       param 0: UNKNOWN
         Unknown bits
         Unknown VR

I constructed this to check dubious check for MEM_REF requiring offset to be 0.
However surprisingly we miss the following too:

struct a {int a;};
struct b {int b; struct a a;};

__attribute__ ((noinline))
static int
reta (struct a a)
{
        return a.a;
}
__attribute__ ((noinline))
static int 
retba (struct b b)
{
  //struct a *a = &b.a;
  //return reta(*a);
  return reta (b.a);
}
int
main()
{
  struct b b = {1, {0}};
  return retba (b);
}

  Jump functions of caller  retba/1:
    callsite  retba/1 -> reta/0 :
       param 0: UNKNOWN
         Unknown bits
         Unknown VR

I wonder which cases actually works :)

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

* [Bug ipa/105917] [10/11/12/13 regression] Missed passthru jump function
  2022-06-10 12:14 [Bug ipa/105917] New: Missed passthru jump function hubicka at gcc dot gnu.org
@ 2022-06-10 13:00 ` hubicka at gcc dot gnu.org
  2022-06-14  7:31 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hubicka at gcc dot gnu.org @ 2022-06-10 13:00 UTC (permalink / raw)
  To: gcc-bugs

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

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Missed passthru jump        |[10/11/12/13 regression]
                   |function                    |Missed passthru jump
                   |                            |function

--- Comment #1 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Looking at the compiler explorer, the both testcases actually works up to gcc
9.5:

reta(a) [clone .constprop.0]:
        xorl    %eax, %eax
        ret
retba(b) [clone .isra.0] [clone .constprop.0]:
        jmp     reta(a) [clone .constprop.0]
main:
        xorl    %edi, %edi
        jmp     retba(b) [clone .isra.0] [clone .constprop.0]

Clang optimizes main to return 0 which we don't due to lack of return
functions.
Also ISRA may trigger on reta+retb and break out the integer rather than
substructure but doesn't.

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

* [Bug ipa/105917] [10/11/12/13 regression] Missed passthru jump function
  2022-06-10 12:14 [Bug ipa/105917] New: Missed passthru jump function hubicka at gcc dot gnu.org
  2022-06-10 13:00 ` [Bug ipa/105917] [10/11/12/13 regression] " hubicka at gcc dot gnu.org
@ 2022-06-14  7:31 ` rguenth at gcc dot gnu.org
  2022-06-15 12:43 ` marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-06-14  7:31 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.4
            Version|unknown                     |13.0
           Keywords|                            |missed-optimization

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

* [Bug ipa/105917] [10/11/12/13 regression] Missed passthru jump function
  2022-06-10 12:14 [Bug ipa/105917] New: Missed passthru jump function hubicka at gcc dot gnu.org
  2022-06-10 13:00 ` [Bug ipa/105917] [10/11/12/13 regression] " hubicka at gcc dot gnu.org
  2022-06-14  7:31 ` rguenth at gcc dot gnu.org
@ 2022-06-15 12:43 ` marxin at gcc dot gnu.org
  2022-06-28 10:49 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-06-15 12:43 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-06-15

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with introduction of IPA SRA r10-3311-gff6686d2e5f797d6.

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

* [Bug ipa/105917] [10/11/12/13 regression] Missed passthru jump function
  2022-06-10 12:14 [Bug ipa/105917] New: Missed passthru jump function hubicka at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-06-15 12:43 ` marxin at gcc dot gnu.org
@ 2022-06-28 10:49 ` jakub at gcc dot gnu.org
  2022-07-25 16:03 ` rguenth at gcc dot gnu.org
  2023-07-07 10:43 ` [Bug ipa/105917] [11/12/13/14 " rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:49 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug ipa/105917] [10/11/12/13 regression] Missed passthru jump function
  2022-06-10 12:14 [Bug ipa/105917] New: Missed passthru jump function hubicka at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-06-28 10:49 ` jakub at gcc dot gnu.org
@ 2022-07-25 16:03 ` rguenth at gcc dot gnu.org
  2023-07-07 10:43 ` [Bug ipa/105917] [11/12/13/14 " rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-07-25 16:03 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug ipa/105917] [11/12/13/14 regression] Missed passthru jump function
  2022-06-10 12:14 [Bug ipa/105917] New: Missed passthru jump function hubicka at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-07-25 16:03 ` rguenth at gcc dot gnu.org
@ 2023-07-07 10:43 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:43 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.5                        |11.5

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.

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

end of thread, other threads:[~2023-07-07 10:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10 12:14 [Bug ipa/105917] New: Missed passthru jump function hubicka at gcc dot gnu.org
2022-06-10 13:00 ` [Bug ipa/105917] [10/11/12/13 regression] " hubicka at gcc dot gnu.org
2022-06-14  7:31 ` rguenth at gcc dot gnu.org
2022-06-15 12:43 ` marxin at gcc dot gnu.org
2022-06-28 10:49 ` jakub at gcc dot gnu.org
2022-07-25 16:03 ` rguenth at gcc dot gnu.org
2023-07-07 10:43 ` [Bug ipa/105917] [11/12/13/14 " rguenth 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).