public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/108000] New: Assert during ipa-cp with AutoFDO
@ 2022-12-07  0:55 erozen at microsoft dot com
  2022-12-07  0:58 ` [Bug ipa/108000] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: erozen at microsoft dot com @ 2022-12-07  0:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108000
           Summary: Assert during ipa-cp with AutoFDO
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: erozen at microsoft dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

The test case below fails with

during IPA pass: cp
/home/erozen/gcc4/gcc/testsuite/gcc.dg/tree-prof/pr11111.c:93:1: internal
compiler error: in good_cloning_opportunity_p, at ipa-cp.cc:3545
0x1d7ee83 good_cloning_opportunity_p
        /home/erozen/gcc4_objdir/../gcc4/gcc/ipa-cp.cc:3545
0x1d7fa66 estimate_local_effects
        /home/erozen/gcc4_objdir/../gcc4/gcc/ipa-cp.cc:3752
0x1d8098d propagate_constants_topo
        /home/erozen/gcc4_objdir/../gcc4/gcc/ipa-cp.cc:4080
0x1d80fa5 ipcp_propagate_stage
        /home/erozen/gcc4_objdir/../gcc4/gcc/ipa-cp.cc:4267
0x1d86fc5 ipcp_driver
        /home/erozen/gcc4_objdir/../gcc4/gcc/ipa-cp.cc:6574
0x1d87192 execute
        /home/erozen/gcc4_objdir/../gcc4/gcc/ipa-cp.cc:6651

#include <stdlib.h>

volatile int flag;
const int array_size = 10;
int* array;
int iterations = 10000000;

#define BAR(num) \
int __attribute__((noinline)) \
bar##num (int i, int j) \
{ \
  if (i == 0) \
    return 2*num - 1; \
  else \
    return 2*num; \
}

BAR(1)
BAR(2)
BAR(3)
BAR(4)
BAR(5)
BAR(6)
BAR(7)
BAR(8)
BAR(9)
BAR(10)
BAR(11)
BAR(12)
BAR(13)
BAR(14)
BAR(15)
BAR(16)
BAR(17)
BAR(18)
BAR(19)

int __attribute__((noinline))
foo ()
{
  switch (flag)
  {
        case 1:
                return bar1 (0, 0);
        case 2:
                return bar2 (0, 0);
        case 3:
                return bar3 (0, 0);
        case 4:
                return bar4 (0, 0);
        case 5:
                return bar5 (0, 0);
        case 6:
                return bar6 (0, 0);
        case 7:
                return bar7 (0, 0);
        case 8:
                return bar8 (0, 0);
        case 9:
                return bar9 (0, 0);
        case 10:
                return bar10 (0, 0);
        case 11:
                return bar11 (0, 0);
        case 12:
                return bar12 (0, 0);
        case 13:
                return bar13 (0, 0);
        case 14:
                return bar14 (0, 0);
        case 15:
                return bar15 (0, 0);
        case 16:
                return bar16 (0, 0);
        case 17:
                return bar17 (0, 0);
        case 18:
                return bar18 (0, 0);
        default:
                return bar19(0, 0);
  }
}

int
main ()
{
  flag = 0;
  array = calloc(array_size, sizeof(int));
  for (int i = 0, j = 0; i < iterations; ++i, j = (j + 1) % 10)
    array[j] = foo ();
}

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

* [Bug ipa/108000] Assert during ipa-cp with AutoFDO
  2022-12-07  0:55 [Bug ipa/108000] New: Assert during ipa-cp with AutoFDO erozen at microsoft dot com
@ 2022-12-07  0:58 ` pinskia at gcc dot gnu.org
  2022-12-07  0:58 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-07  0:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Can you provide the exact command lines being used and does it fail during
while using the profile or before?

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

* [Bug ipa/108000] Assert during ipa-cp with AutoFDO
  2022-12-07  0:55 [Bug ipa/108000] New: Assert during ipa-cp with AutoFDO erozen at microsoft dot com
  2022-12-07  0:58 ` [Bug ipa/108000] " pinskia at gcc dot gnu.org
@ 2022-12-07  0:58 ` pinskia at gcc dot gnu.org
  2022-12-07  1:04 ` erozen at microsoft dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-07  0:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-12-07
             Status|UNCONFIRMED                 |WAITING
     Ever confirmed|0                           |1

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

* [Bug ipa/108000] Assert during ipa-cp with AutoFDO
  2022-12-07  0:55 [Bug ipa/108000] New: Assert during ipa-cp with AutoFDO erozen at microsoft dot com
  2022-12-07  0:58 ` [Bug ipa/108000] " pinskia at gcc dot gnu.org
  2022-12-07  0:58 ` pinskia at gcc dot gnu.org
@ 2022-12-07  1:04 ` erozen at microsoft dot com
  2022-12-07  7:10 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: erozen at microsoft dot com @ 2022-12-07  1:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Eugene Rozenfeld <erozen at microsoft dot com> ---
I actually have a fix for this, just wanted to file a simple test case. I
initially ran into this failure while reviving autoprofiledbootstrap build. The
failure happens while using the profile and the bug is an incorrect count
comparison. 

Here is the patch:
https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606935.html

I will add this test to the patch before submitting it.

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

* [Bug ipa/108000] Assert during ipa-cp with AutoFDO
  2022-12-07  0:55 [Bug ipa/108000] New: Assert during ipa-cp with AutoFDO erozen at microsoft dot com
                   ` (2 preceding siblings ...)
  2022-12-07  1:04 ` erozen at microsoft dot com
@ 2022-12-07  7:10 ` rguenth at gcc dot gnu.org
  2022-12-08  1:16 ` erozen at microsoft dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-12-07  7:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |erozen at microsoft dot com
             Status|WAITING                     |ASSIGNED

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

* [Bug ipa/108000] Assert during ipa-cp with AutoFDO
  2022-12-07  0:55 [Bug ipa/108000] New: Assert during ipa-cp with AutoFDO erozen at microsoft dot com
                   ` (3 preceding siblings ...)
  2022-12-07  7:10 ` rguenth at gcc dot gnu.org
@ 2022-12-08  1:16 ` erozen at microsoft dot com
  2022-12-08 19:53 ` cvs-commit at gcc dot gnu.org
  2022-12-10  0:09 ` erozen at microsoft dot com
  6 siblings, 0 replies; 8+ messages in thread
From: erozen at microsoft dot com @ 2022-12-08  1:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Eugene Rozenfeld <erozen at microsoft dot com> ---
Repro steps:

gcc -O2 -g -o ./pr108000 ./pr108000.c

perf record -e cpu/event=0xC4,umask=0x20/puk -b -m8 -o perf.data ./pr108000

create_gcov --binary ./pr108000 --profile=./perf.data -gcov_version=2
--gcov=./pr108000.gcda

gcc ./pr108000.c -O2 -fauto-profile=./pr108000.gcda -O2 -o ./pr108000.afdo

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

* [Bug ipa/108000] Assert during ipa-cp with AutoFDO
  2022-12-07  0:55 [Bug ipa/108000] New: Assert during ipa-cp with AutoFDO erozen at microsoft dot com
                   ` (4 preceding siblings ...)
  2022-12-08  1:16 ` erozen at microsoft dot com
@ 2022-12-08 19:53 ` cvs-commit at gcc dot gnu.org
  2022-12-10  0:09 ` erozen at microsoft dot com
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-12-08 19:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Eugene Rozenfeld <erozen@gcc.gnu.org>:

https://gcc.gnu.org/g:7410032a772a9e77b620b091c2b551b68113a179

commit r13-4567-g7410032a772a9e77b620b091c2b551b68113a179
Author: Eugene Rozenfeld <erozen@microsoft.com>
Date:   Tue Dec 6 17:05:18 2022 -0800

    Fix count comparison in ipa-cp

    The existing comparison was incorrect for non-PRECISE counts
    (e.g., AFDO): we could end up with a 0 base_count, which could
    lead to asserts, e.g., in good_cloning_opportunity_p.

    Tested on x86_64-pc-linux-gnu.

    gcc/ChangeLog:
            PR ipa/108000
            * ipa-cp.cc (ipcp_propagate_stage): Fix profile count comparison

    gcc/testsuite
            * gcc.dg/tree-prof/pr108000.c: Regression test

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

* [Bug ipa/108000] Assert during ipa-cp with AutoFDO
  2022-12-07  0:55 [Bug ipa/108000] New: Assert during ipa-cp with AutoFDO erozen at microsoft dot com
                   ` (5 preceding siblings ...)
  2022-12-08 19:53 ` cvs-commit at gcc dot gnu.org
@ 2022-12-10  0:09 ` erozen at microsoft dot com
  6 siblings, 0 replies; 8+ messages in thread
From: erozen at microsoft dot com @ 2022-12-10  0:09 UTC (permalink / raw)
  To: gcc-bugs

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

Eugene Rozenfeld <erozen at microsoft dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Eugene Rozenfeld <erozen at microsoft dot com> ---
Fixed by https://gcc.gnu.org/g:7410032a772a9e77b620b091c2b551b68113a179 .

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

end of thread, other threads:[~2022-12-10  0:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-07  0:55 [Bug ipa/108000] New: Assert during ipa-cp with AutoFDO erozen at microsoft dot com
2022-12-07  0:58 ` [Bug ipa/108000] " pinskia at gcc dot gnu.org
2022-12-07  0:58 ` pinskia at gcc dot gnu.org
2022-12-07  1:04 ` erozen at microsoft dot com
2022-12-07  7:10 ` rguenth at gcc dot gnu.org
2022-12-08  1:16 ` erozen at microsoft dot com
2022-12-08 19:53 ` cvs-commit at gcc dot gnu.org
2022-12-10  0:09 ` erozen at microsoft dot com

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).