public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/97816] New: [11 Regression] ICE in good_cloning_opportunity_p, at ipa-cp.c:3266 since r11-4949-gb86aedb0cc083efe712e530a723f1237051a6b56
@ 2020-11-13 12:08 marxin at gcc dot gnu.org
  2020-11-13 12:09 ` [Bug ipa/97816] " marxin at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-11-13 12:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97816
           Summary: [11 Regression] ICE in good_cloning_opportunity_p, at
                    ipa-cp.c:3266 since
                    r11-4949-gb86aedb0cc083efe712e530a723f1237051a6b56
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: jamborm at gcc dot gnu.org, marxin at gcc dot gnu.org
  Target Milestone: ---

Created attachment 49554
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49554&action=edit
test-case

It's reduced from gcc SPEC2017 test:

$ gcc -std=c99 -O3 -flto=1 -march=znver1 -g -fprofile-generate -fgnu89-inline
-shared -fPIC reduced/*.
...
during IPA pass: cp
lto1: internal compiler error: in good_cloning_opportunity_p, at ipa-cp.c:3266
0x22cc3b2 good_cloning_opportunity_p
        /home/marxin/Programming/gcc/gcc/ipa-cp.c:3266
0x22d331a decide_about_value<tree_node*>
        /home/marxin/Programming/gcc/gcc/ipa-cp.c:5502
0x22d1cc4 decide_whether_version_node
        /home/marxin/Programming/gcc/gcc/ipa-cp.c:5573
0x22d25b9 ipcp_decision_stage
        /home/marxin/Programming/gcc/gcc/ipa-cp.c:5754
0x22d2e53 ipcp_driver
        /home/marxin/Programming/gcc/gcc/ipa-cp.c:5942
0x22d3014 execute
        /home/marxin/Programming/gcc/gcc/ipa-cp.c:6017

I'm reducing that more, but it goes very slowly.

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

* [Bug ipa/97816] [11 Regression] ICE in good_cloning_opportunity_p, at ipa-cp.c:3266 since r11-4949-gb86aedb0cc083efe712e530a723f1237051a6b56
  2020-11-13 12:08 [Bug ipa/97816] New: [11 Regression] ICE in good_cloning_opportunity_p, at ipa-cp.c:3266 since r11-4949-gb86aedb0cc083efe712e530a723f1237051a6b56 marxin at gcc dot gnu.org
@ 2020-11-13 12:09 ` marxin at gcc dot gnu.org
  2020-11-13 12:10 ` marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-11-13 12:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-11-13
             Blocks|                            |26163
   Target Milestone|---                         |11.0
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |10.2.0
     Ever confirmed|0                           |1
           Priority|P3                          |P1
      Known to fail|                            |11.0


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26163
[Bug 26163] [meta-bug] missed optimization in SPEC (2k17, 2k and 2k6 and 95)

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

* [Bug ipa/97816] [11 Regression] ICE in good_cloning_opportunity_p, at ipa-cp.c:3266 since r11-4949-gb86aedb0cc083efe712e530a723f1237051a6b56
  2020-11-13 12:08 [Bug ipa/97816] New: [11 Regression] ICE in good_cloning_opportunity_p, at ipa-cp.c:3266 since r11-4949-gb86aedb0cc083efe712e530a723f1237051a6b56 marxin at gcc dot gnu.org
  2020-11-13 12:09 ` [Bug ipa/97816] " marxin at gcc dot gnu.org
@ 2020-11-13 12:10 ` marxin at gcc dot gnu.org
  2020-11-13 12:16 ` marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-11-13 12:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Apparently, without the '-fPIC' option.

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

* [Bug ipa/97816] [11 Regression] ICE in good_cloning_opportunity_p, at ipa-cp.c:3266 since r11-4949-gb86aedb0cc083efe712e530a723f1237051a6b56
  2020-11-13 12:08 [Bug ipa/97816] New: [11 Regression] ICE in good_cloning_opportunity_p, at ipa-cp.c:3266 since r11-4949-gb86aedb0cc083efe712e530a723f1237051a6b56 marxin at gcc dot gnu.org
  2020-11-13 12:09 ` [Bug ipa/97816] " marxin at gcc dot gnu.org
  2020-11-13 12:10 ` marxin at gcc dot gnu.org
@ 2020-11-13 12:16 ` marxin at gcc dot gnu.org
  2020-11-13 12:41 ` jamborm at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-11-13 12:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
size_cost: -2147480169

So it's likely about an integer overflow..

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

* [Bug ipa/97816] [11 Regression] ICE in good_cloning_opportunity_p, at ipa-cp.c:3266 since r11-4949-gb86aedb0cc083efe712e530a723f1237051a6b56
  2020-11-13 12:08 [Bug ipa/97816] New: [11 Regression] ICE in good_cloning_opportunity_p, at ipa-cp.c:3266 since r11-4949-gb86aedb0cc083efe712e530a723f1237051a6b56 marxin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-11-13 12:16 ` marxin at gcc dot gnu.org
@ 2020-11-13 12:41 ` jamborm at gcc dot gnu.org
  2020-11-13 17:30 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jamborm at gcc dot gnu.org @ 2020-11-13 12:41 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Jambor <jamborm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jamborm at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #3 from Martin Jambor <jamborm at gcc dot gnu.org> ---
I see, mine.

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

* [Bug ipa/97816] [11 Regression] ICE in good_cloning_opportunity_p, at ipa-cp.c:3266 since r11-4949-gb86aedb0cc083efe712e530a723f1237051a6b56
  2020-11-13 12:08 [Bug ipa/97816] New: [11 Regression] ICE in good_cloning_opportunity_p, at ipa-cp.c:3266 since r11-4949-gb86aedb0cc083efe712e530a723f1237051a6b56 marxin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-11-13 12:41 ` jamborm at gcc dot gnu.org
@ 2020-11-13 17:30 ` cvs-commit at gcc dot gnu.org
  2020-11-13 17:31 ` jamborm at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-11-13 17:30 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:2e97d6443f0a862ce9b798084499635914e3b8c6

commit r11-5000-g2e97d6443f0a862ce9b798084499635914e3b8c6
Author: Martin Jambor <mjambor@suse.cz>
Date:   Fri Nov 13 18:30:11 2020 +0100

    ipa-cp: One more safe_add (PR 97816)

    The new behavior of safe_add triggered an ICE because of one use where
    it had not been used instead of a simple addition.  I'll fix it with the
    following obvious patch so that periodic benchmarkers can continue
    working because a proper fix (see below) will need a review.

    The testcase showed me, however, that we can propagate time and cost
    from one lattice to another more than once even when that was not the
    intent.  I'll address that as a follow-up after I verify it does not
    affect the IPA-CP heuristics too much or change the corresponding
    params accordingly.

    Bootstrapped and tested on x86_64-linux.

    gcc/ChangeLog:

    2020-11-13  Martin Jambor  <mjambor@suse.cz>

            PR ipa/97816
            * ipa-cp.c (value_topo_info<valtype>::propagate_effects): Use
            safe_add instead of a simple addition.

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

* [Bug ipa/97816] [11 Regression] ICE in good_cloning_opportunity_p, at ipa-cp.c:3266 since r11-4949-gb86aedb0cc083efe712e530a723f1237051a6b56
  2020-11-13 12:08 [Bug ipa/97816] New: [11 Regression] ICE in good_cloning_opportunity_p, at ipa-cp.c:3266 since r11-4949-gb86aedb0cc083efe712e530a723f1237051a6b56 marxin at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-11-13 17:30 ` cvs-commit at gcc dot gnu.org
@ 2020-11-13 17:31 ` jamborm at gcc dot gnu.org
  2020-12-07  8:35 ` cvs-commit at gcc dot gnu.org
  2020-12-07 12:04 ` jamborm at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jamborm at gcc dot gnu.org @ 2020-11-13 17:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Martin Jambor <jamborm at gcc dot gnu.org> ---
As noted in the commit message above, the ICE will go away but the underlying
issue stays so please keep this opened until I fix it, hopefully no later than
next week.

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

* [Bug ipa/97816] [11 Regression] ICE in good_cloning_opportunity_p, at ipa-cp.c:3266 since r11-4949-gb86aedb0cc083efe712e530a723f1237051a6b56
  2020-11-13 12:08 [Bug ipa/97816] New: [11 Regression] ICE in good_cloning_opportunity_p, at ipa-cp.c:3266 since r11-4949-gb86aedb0cc083efe712e530a723f1237051a6b56 marxin at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2020-11-13 17:31 ` jamborm at gcc dot gnu.org
@ 2020-12-07  8:35 ` cvs-commit at gcc dot gnu.org
  2020-12-07 12:04 ` jamborm at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-12-07  8:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Jambor <jamborm@gcc.gnu.org>:

https://gcc.gnu.org/g:a6a0db7d1bc7ad640bab51769e53f1cb4ad4bb88

commit r11-5811-ga6a0db7d1bc7ad640bab51769e53f1cb4ad4bb88
Author: Martin Jambor <mjambor@suse.cz>
Date:   Mon Dec 7 09:35:09 2020 +0100

    ipa-cp: Avoid unwanted multiple propagations (PR 97816)

    When looking at the testcase of PR 97816 I realized that the reason
    why we were hitting overflows in size growth estimates in IPA-CP is
    not because the chains of how lattices feed values to each other are
    so long but mainly because we add estimates in callee lattices to
    caller lattices for each value source, which roughly corresponds to a
    call graph edge, and therefore if there are multiple calls between two
    functions passing the same value in a parameter we end up doing it
    more than once, sometimes actually quite many times.

    This patch avoids it by using a has_set to remember the source values
    we have already updated and not increasing their size again.
    Furhtermore, to improve estimation of times we scale the propagated
    time benefits with edge frequencies as we accumulate them.

    This should make any overflows very unlikely but not impossible, so I
    still included checks for overflows but decided to restructure the
    code to only need it in the propagate_effects function and modified it
    so that it does not need to perform the check before each sum.

    This is because I decided to add local estimates to propagated
    estimates already in propagate_effects and not at the evaluation time.
    The function can then do the sums in a wide type and discard them in
    the unlikely case of an overflow.  I also decided to use the
    opportunity to make propagated effect stats now include stats from
    other values in the same SCCs.  In the dumps I have seen this tended
    to increase size cost a tiny bit more than the estimated time benefit
    but both increases were small.

    Martin

    gcc/ChangeLog:

    2020-11-20  Martin Jambor  <mjambor@suse.cz>

            PR ipa/97816
            * ipa-cp.c (safe_add): Removed.
            (good_cloning_opportunity_p): Remove special handling of INT_MAX.
            (value_topo_info<valtype>::propagate_effects): Take care not to
            propagate from size one value to another through more sources. 
Scale
            propagated times with edge frequencies.  Include local time and
size
            in propagates ones here.  Take care not to overflow size.
            (decide_about_value): Do not add local and propagated effects when
            passing them to good_cloning_opportunity_p.

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

* [Bug ipa/97816] [11 Regression] ICE in good_cloning_opportunity_p, at ipa-cp.c:3266 since r11-4949-gb86aedb0cc083efe712e530a723f1237051a6b56
  2020-11-13 12:08 [Bug ipa/97816] New: [11 Regression] ICE in good_cloning_opportunity_p, at ipa-cp.c:3266 since r11-4949-gb86aedb0cc083efe712e530a723f1237051a6b56 marxin at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2020-12-07  8:35 ` cvs-commit at gcc dot gnu.org
@ 2020-12-07 12:04 ` jamborm at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jamborm at gcc dot gnu.org @ 2020-12-07 12:04 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Jambor <jamborm at gcc dot gnu.org> changed:

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

--- Comment #7 from Martin Jambor <jamborm at gcc dot gnu.org> ---
Now fixed properly.

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

end of thread, other threads:[~2020-12-07 12:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-13 12:08 [Bug ipa/97816] New: [11 Regression] ICE in good_cloning_opportunity_p, at ipa-cp.c:3266 since r11-4949-gb86aedb0cc083efe712e530a723f1237051a6b56 marxin at gcc dot gnu.org
2020-11-13 12:09 ` [Bug ipa/97816] " marxin at gcc dot gnu.org
2020-11-13 12:10 ` marxin at gcc dot gnu.org
2020-11-13 12:16 ` marxin at gcc dot gnu.org
2020-11-13 12:41 ` jamborm at gcc dot gnu.org
2020-11-13 17:30 ` cvs-commit at gcc dot gnu.org
2020-11-13 17:31 ` jamborm at gcc dot gnu.org
2020-12-07  8:35 ` cvs-commit at gcc dot gnu.org
2020-12-07 12:04 ` jamborm 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).