public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/111622] New: [13 Regression] EVRP compile-time hog compiling risc-v insn-opinit.cc
@ 2023-09-28  8:43 rguenth at gcc dot gnu.org
  2023-09-28  8:44 ` [Bug tree-optimization/111622] " rguenth at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-09-28  8:43 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111622
           Summary: [13 Regression] EVRP compile-time hog compiling risc-v
                    insn-opinit.cc
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

Compiling insn-opinit.cc with a x86_64 GCC 13.2 host compiler targeting
riscv64-linux with -O2 shows

 tree Early VRP                     :  97.26 ( 77%)   0.01 (  1%)  97.28 ( 76%)
 2908k (  0%)
 TOTAL                              : 127.13          1.06        128.21       
  931M

and sofar unchanged on the branch head.

It's improved with GCC 14 where we instead have the worst passes being

 alias stmt walking                 :   5.89 ( 19%)   0.10 ( 10%)   6.01 ( 19%)
 8531k (  1%)
 tree FRE                           :   4.73 ( 16%)   0.04 (  4%)   4.76 ( 15%)
 4325k (  0%)

GCC 12 is fine as well.

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

* [Bug tree-optimization/111622] [13 Regression] EVRP compile-time hog compiling risc-v insn-opinit.cc
  2023-09-28  8:43 [Bug tree-optimization/111622] New: [13 Regression] EVRP compile-time hog compiling risc-v insn-opinit.cc rguenth at gcc dot gnu.org
@ 2023-09-28  8:44 ` rguenth at gcc dot gnu.org
  2023-09-28  8:44 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-09-28  8:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.3
           Keywords|                            |compile-time-hog
                 CC|                            |amacleod at redhat dot com

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

* [Bug tree-optimization/111622] [13 Regression] EVRP compile-time hog compiling risc-v insn-opinit.cc
  2023-09-28  8:43 [Bug tree-optimization/111622] New: [13 Regression] EVRP compile-time hog compiling risc-v insn-opinit.cc rguenth at gcc dot gnu.org
  2023-09-28  8:44 ` [Bug tree-optimization/111622] " rguenth at gcc dot gnu.org
@ 2023-09-28  8:44 ` rguenth at gcc dot gnu.org
  2023-09-28  8:45 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-09-28  8:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Created attachment 56006
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56006&action=edit
preprocessed riscv insn-opinit.cc

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

* [Bug tree-optimization/111622] [13 Regression] EVRP compile-time hog compiling risc-v insn-opinit.cc
  2023-09-28  8:43 [Bug tree-optimization/111622] New: [13 Regression] EVRP compile-time hog compiling risc-v insn-opinit.cc rguenth at gcc dot gnu.org
  2023-09-28  8:44 ` [Bug tree-optimization/111622] " rguenth at gcc dot gnu.org
  2023-09-28  8:44 ` rguenth at gcc dot gnu.org
@ 2023-09-28  8:45 ` rguenth at gcc dot gnu.org
  2023-09-28 14:58 ` amacleod at redhat dot com
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-09-28  8:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |needs-bisection,
                   |                            |needs-reduction

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Need to identify what fixed it on trunk, we probably want to backport that if
possible.

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

* [Bug tree-optimization/111622] [13 Regression] EVRP compile-time hog compiling risc-v insn-opinit.cc
  2023-09-28  8:43 [Bug tree-optimization/111622] New: [13 Regression] EVRP compile-time hog compiling risc-v insn-opinit.cc rguenth at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-09-28  8:45 ` rguenth at gcc dot gnu.org
@ 2023-09-28 14:58 ` amacleod at redhat dot com
  2023-09-29  6:17 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: amacleod at redhat dot com @ 2023-09-28 14:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Macleod <amacleod at redhat dot com> ---
(In reply to Richard Biener from comment #1)
> Created attachment 56006 [details]
> preprocessed riscv insn-opinit.cc

I get 

i.ii:2203:11: fatal error: definition of ‘class std::initializer_list<_E>’ does
not match ‘#include <initializer_list>’
 2203 |     class initializer_list
      |           ^~~~~~~~~~~~~~~~
compilation terminated.

 with the .ii file...  do I need something else?

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

* [Bug tree-optimization/111622] [13 Regression] EVRP compile-time hog compiling risc-v insn-opinit.cc
  2023-09-28  8:43 [Bug tree-optimization/111622] New: [13 Regression] EVRP compile-time hog compiling risc-v insn-opinit.cc rguenth at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-09-28 14:58 ` amacleod at redhat dot com
@ 2023-09-29  6:17 ` rguenth at gcc dot gnu.org
  2023-09-29  6:20 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-09-29  6:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
For riscv cross compilers you need to invoke the driver since that feeds -mabi
and -march to cc1plus required to identify the target as 64bit ...

That would be -march=rv64imafdc_zicsr_zifencei -mabi=lp64d for example.

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

* [Bug tree-optimization/111622] [13 Regression] EVRP compile-time hog compiling risc-v insn-opinit.cc
  2023-09-28  8:43 [Bug tree-optimization/111622] New: [13 Regression] EVRP compile-time hog compiling risc-v insn-opinit.cc rguenth at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-09-29  6:17 ` rguenth at gcc dot gnu.org
@ 2023-09-29  6:20 ` rguenth at gcc dot gnu.org
  2023-10-12 16:32 ` amacleod at redhat dot com
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-09-29  6:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #4)
> For riscv cross compilers you need to invoke the driver since that feeds
> -mabi and -march to cc1plus required to identify the target as 64bit ...
> 
> That would be -march=rv64imafdc_zicsr_zifencei -mabi=lp64d for example.

Err, forget that.  The testcase is for a x86_64 compiler, but you need
-fno-exceptions -fno-rtti -O2 to reproduce the GCC case exactly (it also
works with plain -O2).

So, this is in _building_ a x86_64 -> riscv cross (not using it).

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

* [Bug tree-optimization/111622] [13 Regression] EVRP compile-time hog compiling risc-v insn-opinit.cc
  2023-09-28  8:43 [Bug tree-optimization/111622] New: [13 Regression] EVRP compile-time hog compiling risc-v insn-opinit.cc rguenth at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2023-09-29  6:20 ` rguenth at gcc dot gnu.org
@ 2023-10-12 16:32 ` amacleod at redhat dot com
  2023-10-13 13:23 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: amacleod at redhat dot com @ 2023-10-12 16:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Andrew Macleod <amacleod at redhat dot com> ---
Interesting.

The "fix" turns out to be:

commit 9ea74d235c7e7816b996a17c61288f02ef767985
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Sep 14 09:31:23 2023 +0200

    tree-optimization/111294 - better DCE after forwprop 

    The following adds more aggressive DCE to forwprop to clean up dead
    stmts when folding a stmt leaves some operands unused.  The patch 
    uses simple_dce_from_worklist for this purpose, queueing original 
    operands before substitution and folding, but only if we folded the
    stmt.

    This removes one dead stmt biasing threading costs in a later pass
    but it doesn't resolve the optimization issue in the PR yet.

Which implies something pathological was triggering in VRP, so I dug a little
deeper...

It seems to be a massive number of partial equivalencies generated by sequences
like:
  _5 = (unsigned int) _1;
  _10 = (unsigned int) _1;
  _15 = (unsigned int) _1;
  _20 = (unsigned int) _1;
  _25 = (unsigned int) _1;
<...>
for a couple of hundred statements.   these are all then members of a partial
equivalence set, and we end up doing obscene amounts of pointless looping and
recomputing of ranges of things in the set when say _1 may change.

The intent of partial equivalence is to allow us to reflect known subranges
thru casts, but not to build up large groups like in an equivalence. There
should be a limit to the size. We start to lose most of the usefulness when the
grouping gets too large.

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

* [Bug tree-optimization/111622] [13 Regression] EVRP compile-time hog compiling risc-v insn-opinit.cc
  2023-09-28  8:43 [Bug tree-optimization/111622] New: [13 Regression] EVRP compile-time hog compiling risc-v insn-opinit.cc rguenth at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2023-10-12 16:32 ` amacleod at redhat dot com
@ 2023-10-13 13:23 ` cvs-commit at gcc dot gnu.org
  2023-10-13 13:23 ` cvs-commit at gcc dot gnu.org
  2023-10-13 13:50 ` amacleod at redhat dot com
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-10-13 13:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Andrew Macleod <amacleod@gcc.gnu.org>:

https://gcc.gnu.org/g:8be20f3b0bded7f9b690b27cbee58b283dbe827b

commit r14-4630-g8be20f3b0bded7f9b690b27cbee58b283dbe827b
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Thu Oct 12 17:06:36 2023 -0400

    Do not add partial equivalences with no uses.

            PR tree-optimization/111622
            * value-relation.cc (equiv_oracle::add_partial_equiv): Do not
            register a partial equivalence if an operand has no uses.

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

* [Bug tree-optimization/111622] [13 Regression] EVRP compile-time hog compiling risc-v insn-opinit.cc
  2023-09-28  8:43 [Bug tree-optimization/111622] New: [13 Regression] EVRP compile-time hog compiling risc-v insn-opinit.cc rguenth at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2023-10-13 13:23 ` cvs-commit at gcc dot gnu.org
@ 2023-10-13 13:23 ` cvs-commit at gcc dot gnu.org
  2023-10-13 13:50 ` amacleod at redhat dot com
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-10-13 13:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Andrew Macleod
<amacleod@gcc.gnu.org>:

https://gcc.gnu.org/g:1c2bd0839e3574ab2a76ec18faf906b2f64b5f81

commit r13-7949-g1c2bd0839e3574ab2a76ec18faf906b2f64b5f81
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Thu Oct 12 17:06:36 2023 -0400

    Do not add partial equivalences with no uses.

            PR tree-optimization/111622
            * value-relation.cc (equiv_oracle::add_partial_equiv): Do not
            register a partial equivalence if an operand has no uses.

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

* [Bug tree-optimization/111622] [13 Regression] EVRP compile-time hog compiling risc-v insn-opinit.cc
  2023-09-28  8:43 [Bug tree-optimization/111622] New: [13 Regression] EVRP compile-time hog compiling risc-v insn-opinit.cc rguenth at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2023-10-13 13:23 ` cvs-commit at gcc dot gnu.org
@ 2023-10-13 13:50 ` amacleod at redhat dot com
  9 siblings, 0 replies; 11+ messages in thread
From: amacleod at redhat dot com @ 2023-10-13 13:50 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Macleod <amacleod at redhat dot com> changed:

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

--- Comment #9 from Andrew Macleod <amacleod at redhat dot com> ---
Fixed.

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

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

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-28  8:43 [Bug tree-optimization/111622] New: [13 Regression] EVRP compile-time hog compiling risc-v insn-opinit.cc rguenth at gcc dot gnu.org
2023-09-28  8:44 ` [Bug tree-optimization/111622] " rguenth at gcc dot gnu.org
2023-09-28  8:44 ` rguenth at gcc dot gnu.org
2023-09-28  8:45 ` rguenth at gcc dot gnu.org
2023-09-28 14:58 ` amacleod at redhat dot com
2023-09-29  6:17 ` rguenth at gcc dot gnu.org
2023-09-29  6:20 ` rguenth at gcc dot gnu.org
2023-10-12 16:32 ` amacleod at redhat dot com
2023-10-13 13:23 ` cvs-commit at gcc dot gnu.org
2023-10-13 13:23 ` cvs-commit at gcc dot gnu.org
2023-10-13 13:50 ` amacleod at redhat 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).