public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/93435] [8/9/10 Regression] Hang with -O2 on innocuous looking code with GCC 8.3
       [not found] <bug-93435-4@http.gcc.gnu.org/bugzilla/>
@ 2020-03-17 13:26 ` jakub at gcc dot gnu.org
  2020-03-19 13:31 ` jamborm at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-17 13:26 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Martin, could you please have a look?

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

* [Bug tree-optimization/93435] [8/9/10 Regression] Hang with -O2 on innocuous looking code with GCC 8.3
       [not found] <bug-93435-4@http.gcc.gnu.org/bugzilla/>
  2020-03-17 13:26 ` [Bug tree-optimization/93435] [8/9/10 Regression] Hang with -O2 on innocuous looking code with GCC 8.3 jakub at gcc dot gnu.org
@ 2020-03-19 13:31 ` jamborm at gcc dot gnu.org
  2020-03-20 23:21 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: jamborm at gcc dot gnu.org @ 2020-03-19 13:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Martin Jambor <jamborm at gcc dot gnu.org> ---
The issue actually started with my r8-344-2bba75411e1 and it is
basically a perfect SRA bomb, it makes SRA sub-access propagation
accross assignments create gazillions of accesses and then
replacements, because they facilitate forward propagation (and as ccp3
dumps shows, they do).

I already have a patch that simply limits the number of replacements
to a param, defaulting to 128, which makes the testcase compilation
finish in about 9 seconds on my machine.  However, SRA analysis still
takes 7 seconds of that, so I'm looking at capping the propagation
earlier.  That takes more book-keeping, so at least for backports, I'd
like to use the simpler approach on released branches.

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

* [Bug tree-optimization/93435] [8/9/10 Regression] Hang with -O2 on innocuous looking code with GCC 8.3
       [not found] <bug-93435-4@http.gcc.gnu.org/bugzilla/>
  2020-03-17 13:26 ` [Bug tree-optimization/93435] [8/9/10 Regression] Hang with -O2 on innocuous looking code with GCC 8.3 jakub at gcc dot gnu.org
  2020-03-19 13:31 ` jamborm at gcc dot gnu.org
@ 2020-03-20 23:21 ` cvs-commit at gcc dot gnu.org
  2020-03-20 23:24 ` [Bug tree-optimization/93435] [8/9 " jamborm at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-03-20 23:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 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:29f23ed79b60949fc60f6fdbbd931bd58090b241

commit r10-7309-g29f23ed79b60949fc60f6fdbbd931bd58090b241
Author: Martin Jambor <mjambor@suse.cz>
Date:   Sat Mar 21 00:21:02 2020 +0100

    sra: Cap number of sub-access propagations with a param (PR 93435)

    PR 93435 is a perfect SRA bomb.  It initializes an array of 16 chars
    element-wise, then uses that to initialize an aggregate that consists
    of four such arrays, that one to initialize one four times as big as
    the previous one all the way to an aggregate that has 64kb.

    This causes the sub-access propagation across assignments to create
    thousands of byte-sized artificial accesses which are then eligible to
    be replaced - they do facilitate forward propagation but there is
    enough of them for DSE to never finish.

    This patch avoids that situation by accounting how many of such
    replacements can be created per SRA candidate.  The default value of
    32 was just the largest power of two that did not slow down
    compilation of the testcase, but it should also hopefully be big
    enough for any reasonable input that might rely on the optimization.

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

            PR tree-optimization/93435
            * params.opt (sra-max-propagations): New parameter.
            * tree-sra.c (propagation_budget): New variable.
            (budget_for_propagation_access): New function.
            (propagate_subaccesses_from_rhs): Use it.
            (propagate_subaccesses_from_lhs): Likewise.
            (propagate_all_subaccesses): Set up and destroy propagation_budget.

            gcc/testsuite/
            * gcc.dg/tree-ssa/pr93435.c: New test.

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

* [Bug tree-optimization/93435] [8/9 Regression] Hang with -O2 on innocuous looking code with GCC 8.3
       [not found] <bug-93435-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2020-03-20 23:21 ` cvs-commit at gcc dot gnu.org
@ 2020-03-20 23:24 ` jamborm at gcc dot gnu.org
  2020-04-03 18:33 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: jamborm at gcc dot gnu.org @ 2020-03-20 23:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[8/9/10 Regression] Hang    |[8/9 Regression] Hang with
                   |with -O2 on innocuous       |-O2 on innocuous looking
                   |looking code with GCC 8.3   |code with GCC 8.3

--- Comment #10 from Martin Jambor <jamborm at gcc dot gnu.org> ---
Fixed on trunk with
https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542390.html

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

* [Bug tree-optimization/93435] [8/9 Regression] Hang with -O2 on innocuous looking code with GCC 8.3
       [not found] <bug-93435-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2020-03-20 23:24 ` [Bug tree-optimization/93435] [8/9 " jamborm at gcc dot gnu.org
@ 2020-04-03 18:33 ` cvs-commit at gcc dot gnu.org
  2020-04-03 20:01 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-03 18:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

commit r9-8449-ga1bb16994caed4dacf8c9ee1a33b177df140e9dc
Author: Martin Jambor <mjambor@suse.cz>
Date:   Fri Apr 3 20:32:44 2020 +0200

    gcc-9 sra: Cap number of sub-access propagations with a param (PR 93435)

    This is non-trivial but rather straightforward backport of
    29f23ed79b60949fc60f6fdbbd931bd58090b241 from master.  See
    https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542390.html for
    more information.

    2020-04-02  Martin Jambor  <mjambor@suse.cz>

            PR tree-optimization/93435
            * params.def (PARAM_SRA_MAX_PROPAGATIONS): New parameter.
            * tree-sra.c (propagation_budget): New variable.
            (budget_for_propagation_access): New function.
            (propagate_subaccesses_across_link): Use it.
            (propagate_all_subaccesses): Set up and destroy propagation_budget.
            * doc/invoke.texi (sra-max-propagations): New.

            testsuite/
            * gcc.dg/tree-ssa/pr93435.c: New test.

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

* [Bug tree-optimization/93435] [8/9 Regression] Hang with -O2 on innocuous looking code with GCC 8.3
       [not found] <bug-93435-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2020-04-03 18:33 ` cvs-commit at gcc dot gnu.org
@ 2020-04-03 20:01 ` cvs-commit at gcc dot gnu.org
  2020-04-03 20:09 ` jamborm at gcc dot gnu.org
  2021-04-30  7:58 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-03 20:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

commit r8-10163-gb445ceec81ba3f4afad8c3ead1e58f14f1c2e146
Author: Martin Jambor <mjambor@suse.cz>
Date:   Fri Apr 3 22:01:17 2020 +0200

    gcc-8 sra: Cap number of sub-access propagations with a param (PR 93435)

    This is non-trivial but rather straightforward backport of
    29f23ed79b60949fc60f6fdbbd931bd58090b241 from master.  See
    https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542390.html for
    more information.

    Bootstrapped and tested on gcc-8 branch.

    2020-04-03  Martin Jambor  <mjambor@suse.cz>

            PR tree-optimization/93435
            * params.def (PARAM_SRA_MAX_PROPAGATIONS): New parameter.
            * tree-sra.c (propagation_budget): New variable.
            (budget_for_propagation_access): New function.
            (propagate_subaccesses_across_link): Use it.
            (propagate_all_subaccesses): Set up and destroy propagation_budget.
            * doc/invoke.texi (sra-max-propagations): New.

            testsuite/
            * gcc.dg/tree-ssa/pr93435.c: New test.

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

* [Bug tree-optimization/93435] [8/9 Regression] Hang with -O2 on innocuous looking code with GCC 8.3
       [not found] <bug-93435-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2020-04-03 20:01 ` cvs-commit at gcc dot gnu.org
@ 2020-04-03 20:09 ` jamborm at gcc dot gnu.org
  2021-04-30  7:58 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 8+ messages in thread
From: jamborm at gcc dot gnu.org @ 2020-04-03 20:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Martin Jambor <jamborm at gcc dot gnu.org> ---
The problematic behavior of SRA is now fixed on master and both opened
release branches so I consider my work done here.

I'm leaving the bug opened in case Jeff wants to add some DSE limiter
like he wrote in comment #5.

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

* [Bug tree-optimization/93435] [8/9 Regression] Hang with -O2 on innocuous looking code with GCC 8.3
       [not found] <bug-93435-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2020-04-03 20:09 ` jamborm at gcc dot gnu.org
@ 2021-04-30  7:58 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-30  7:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to work|                            |8.4.1, 9.3.1
         Resolution|---                         |FIXED

--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> ---
Let's close the bug.  The DSE issue should be tracked elsewhere with an actual
testcase that still fails.

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

end of thread, other threads:[~2021-04-30  7:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-93435-4@http.gcc.gnu.org/bugzilla/>
2020-03-17 13:26 ` [Bug tree-optimization/93435] [8/9/10 Regression] Hang with -O2 on innocuous looking code with GCC 8.3 jakub at gcc dot gnu.org
2020-03-19 13:31 ` jamborm at gcc dot gnu.org
2020-03-20 23:21 ` cvs-commit at gcc dot gnu.org
2020-03-20 23:24 ` [Bug tree-optimization/93435] [8/9 " jamborm at gcc dot gnu.org
2020-04-03 18:33 ` cvs-commit at gcc dot gnu.org
2020-04-03 20:01 ` cvs-commit at gcc dot gnu.org
2020-04-03 20:09 ` jamborm at gcc dot gnu.org
2021-04-30  7:58 ` 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).