public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/104120] New: slow compilation with only "-g3 -O1"; other opt levels are fine
@ 2022-01-19 15:23 cnsun at uwaterloo dot ca
  2022-01-19 16:00 ` [Bug c/104120] [10/11/12 Regression] slow compilation with only "-g3 -O1"; other opt levels are fine since r10-15-gf179b64e3ab013ff marxin at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: cnsun at uwaterloo dot ca @ 2022-01-19 15:23 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104120
           Summary: slow compilation with only "-g3 -O1"; other opt levels
                    are fine
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ cat t.c 
void acc_routine(void) {
  int i, j, k, sum, diff;
  for (i = 0; i < 10; i++)
    for (j = 0; j < 10; j++)
      for (k = 0; k < 10; k++)
        sum = 1;
  for (i = 0; i < 10; i++)
    for (j = 0; j < 10; j++)
      for (k = 0; k < 10; k++)
        sum = 1;
  for (i = 0; i < 10; i++)
    for (j = 0; j < 10; j++)
      for (k = 0; k < 10; k++)
        sum = 1;
  for (i = 0; i < 10; i++)
    for (j = 0; j < 10; j++)
      for (k = 0; k < 10; k++)
        sum = 1;
  for (i = 0; i < 10; i++)
    for (j = 0; j < 10; j++)
      for (k = 0; k < 10; k++)
        sum = 1;
}
$ 
$ time gcc-trunk -c -g3 t.c -O1

real    0m43.205s
user    0m43.137s
sys     0m0.054s
$ 
$ time gcc-trunk -c -g3 t.c -O0

real    0m0.034s
user    0m0.022s
sys     0m0.012s
$ time gcc-trunk -c t.c -O1

real    0m0.043s
user    0m0.037s
sys     0m0.006s
$ 
$ time gcc-trunk -c t.c -O2

real    0m0.033s
user    0m0.027s
sys     0m0.007s
$ time gcc-trunk -c t.c -O3

real    0m0.032s
user    0m0.017s
sys     0m0.015s
$ 
$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.2nPqmFoxaU-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.1 20220119 (experimental) [master -g1ead972ce] (GCC)

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

* [Bug c/104120] [10/11/12 Regression] slow compilation with only "-g3 -O1"; other opt levels are fine since r10-15-gf179b64e3ab013ff
  2022-01-19 15:23 [Bug c/104120] New: slow compilation with only "-g3 -O1"; other opt levels are fine cnsun at uwaterloo dot ca
@ 2022-01-19 16:00 ` marxin at gcc dot gnu.org
  2022-01-20  2:04 ` [Bug debug/104120] " pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-01-19 16:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
            Summary|slow compilation with only  |[10/11/12 Regression] slow
                   |"-g3 -O1"; other opt levels |compilation with only "-g3
                   |are fine                    |-O1"; other opt levels are
                   |                            |fine since
                   |                            |r10-15-gf179b64e3ab013ff
   Last reconfirmed|                            |2022-01-19
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r10-15-gf179b64e3ab013ff.

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

* [Bug debug/104120] [10/11/12 Regression] slow compilation with only "-g3 -O1"; other opt levels are fine since r10-15-gf179b64e3ab013ff
  2022-01-19 15:23 [Bug c/104120] New: slow compilation with only "-g3 -O1"; other opt levels are fine cnsun at uwaterloo dot ca
  2022-01-19 16:00 ` [Bug c/104120] [10/11/12 Regression] slow compilation with only "-g3 -O1"; other opt levels are fine since r10-15-gf179b64e3ab013ff marxin at gcc dot gnu.org
@ 2022-01-20  2:04 ` pinskia at gcc dot gnu.org
  2022-01-20  2:04 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-20  2:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I suspect it is this part which introduced more debug statements which made it
slower:
* c-typeck.c (c_finish_loop): Add COND_LOCUS and INCR_LOCUS arguments,
emit DEBUG_BEGIN_STMTs if needed

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

* [Bug debug/104120] [10/11/12 Regression] slow compilation with only "-g3 -O1"; other opt levels are fine since r10-15-gf179b64e3ab013ff
  2022-01-19 15:23 [Bug c/104120] New: slow compilation with only "-g3 -O1"; other opt levels are fine cnsun at uwaterloo dot ca
  2022-01-19 16:00 ` [Bug c/104120] [10/11/12 Regression] slow compilation with only "-g3 -O1"; other opt levels are fine since r10-15-gf179b64e3ab013ff marxin at gcc dot gnu.org
  2022-01-20  2:04 ` [Bug debug/104120] " pinskia at gcc dot gnu.org
@ 2022-01-20  2:04 ` pinskia at gcc dot gnu.org
  2022-01-20  7:51 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-20  2:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
now I wonder if the C++ front-end emits worse debugging info than the C
front-end too ....

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

* [Bug debug/104120] [10/11/12 Regression] slow compilation with only "-g3 -O1"; other opt levels are fine since r10-15-gf179b64e3ab013ff
  2022-01-19 15:23 [Bug c/104120] New: slow compilation with only "-g3 -O1"; other opt levels are fine cnsun at uwaterloo dot ca
                   ` (2 preceding siblings ...)
  2022-01-20  2:04 ` pinskia at gcc dot gnu.org
@ 2022-01-20  7:51 ` rguenth at gcc dot gnu.org
  2022-03-09 13:28 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-20  7:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |11.2.1
                 CC|                            |aoliva at gcc dot gnu.org
   Target Milestone|---                         |10.4

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
With -fno-checking the profile is quite flat but we fully unroll the loops at
-O1, duplicating the debug stmts while with -O2+ CD-DCE simply kills them off.
I suppose -O1 lacks simple empty loop removal capability here.

On a related note we miss removal of consecutive debug stmts that do not add
any information - we end up with

  <bb 2> [local count: 975816]:
  [t.c:2:3] # DEBUG BEGIN_STMT
  [t.c:3:3] # DEBUG BEGIN_STMT
  # DEBUG i => 0
  [t.c:3:17] # DEBUG BEGIN_STMT
  # DEBUG i => 0
  # DEBUG j => 0
  [t.c:4:19] # DEBUG BEGIN_STMT
  # DEBUG j => 0
  # DEBUG k => 0
  [t.c:5:21] # DEBUG BEGIN_STMT
  [t.c:6:13] # DEBUG sum => NULL
  # DEBUG k => 0
  [t.c:6:9] # DEBUG BEGIN_STMT
  [t.c:6:13] # DEBUG sum => 1
  [t.c:5:28] # DEBUG BEGIN_STMT
  # DEBUG k => 1
  [t.c:5:21] # DEBUG BEGIN_STMT
  [t.c:6:13] # DEBUG sum => NULL
  # DEBUG k => 1
  [t.c:6:9] # DEBUG BEGIN_STMT
  [t.c:6:13] # DEBUG sum => 1
  [t.c:5:28] # DEBUG BEGIN_STMT
  # DEBUG k => 2
  [t.c:5:21] # DEBUG BEGIN_STMT
  [t.c:6:13] # DEBUG sum => NULL
...

I suppose with views we could indeed step through all (non-existant) stmts
but then this support never materialized ...

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

* [Bug debug/104120] [10/11/12 Regression] slow compilation with only "-g3 -O1"; other opt levels are fine since r10-15-gf179b64e3ab013ff
  2022-01-19 15:23 [Bug c/104120] New: slow compilation with only "-g3 -O1"; other opt levels are fine cnsun at uwaterloo dot ca
                   ` (3 preceding siblings ...)
  2022-01-20  7:51 ` rguenth at gcc dot gnu.org
@ 2022-03-09 13:28 ` rguenth at gcc dot gnu.org
  2022-06-28 10:47 ` [Bug debug/104120] [10/11/12/13 " jakub at gcc dot gnu.org
  2023-07-07 10:42 ` [Bug debug/104120] [11/12/13/14 " rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-03-09 13:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug debug/104120] [10/11/12/13 Regression] slow compilation with only "-g3 -O1"; other opt levels are fine since r10-15-gf179b64e3ab013ff
  2022-01-19 15:23 [Bug c/104120] New: slow compilation with only "-g3 -O1"; other opt levels are fine cnsun at uwaterloo dot ca
                   ` (4 preceding siblings ...)
  2022-03-09 13:28 ` rguenth at gcc dot gnu.org
@ 2022-06-28 10:47 ` jakub at gcc dot gnu.org
  2023-07-07 10:42 ` [Bug debug/104120] [11/12/13/14 " rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 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] 8+ messages in thread

* [Bug debug/104120] [11/12/13/14 Regression] slow compilation with only "-g3 -O1"; other opt levels are fine since r10-15-gf179b64e3ab013ff
  2022-01-19 15:23 [Bug c/104120] New: slow compilation with only "-g3 -O1"; other opt levels are fine cnsun at uwaterloo dot ca
                   ` (5 preceding siblings ...)
  2022-06-28 10:47 ` [Bug debug/104120] [10/11/12/13 " jakub at gcc dot gnu.org
@ 2023-07-07 10:42 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19 15:23 [Bug c/104120] New: slow compilation with only "-g3 -O1"; other opt levels are fine cnsun at uwaterloo dot ca
2022-01-19 16:00 ` [Bug c/104120] [10/11/12 Regression] slow compilation with only "-g3 -O1"; other opt levels are fine since r10-15-gf179b64e3ab013ff marxin at gcc dot gnu.org
2022-01-20  2:04 ` [Bug debug/104120] " pinskia at gcc dot gnu.org
2022-01-20  2:04 ` pinskia at gcc dot gnu.org
2022-01-20  7:51 ` rguenth at gcc dot gnu.org
2022-03-09 13:28 ` rguenth at gcc dot gnu.org
2022-06-28 10:47 ` [Bug debug/104120] [10/11/12/13 " jakub at gcc dot gnu.org
2023-07-07 10:42 ` [Bug debug/104120] [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).