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

            Bug ID: 101555
           Summary: Compile slowdown in tree PRE
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wsnyder at wsnyder dot org
  Target Milestone: ---

Running

   g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0

as

   g++ -I. -c -Os -ftime-report -o /dev/null Vara___024root__114_0.cpp

takes 297 CPU seconds.

On clang version 10.0.0-4ubuntu1 it takes 37 seconds total.

In GCC, 276 of 297 seconds are in the "tree PRE" stage. Splitting the large
function into roughly three pieces (Vara___024root__114_0.cpp, _1 and _2)
the "tree PRE" stage takes 12.7, 7.8 and 3.9 seconds (totalling 24.4).
Therefore I suspect some O(n^2) issue in tree PRE.

Note removing -Os makes gcc much faster, but still signifcantly slower than
clang.

This issue was originally reported using gcc 8.2.0 by Matheus Cavalcante 
at https://github.com/verilator/verilator/issues/3072

Reply via email to