<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Clang 6.0 takes extremely long time to compile a specific file."
   href="https://bugs.llvm.org/show_bug.cgi?id=37464">37464</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang 6.0 takes extremely long time to compile a specific file.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>6.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>FreeBSD
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>LLVM Codegen
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>FreeBSD@Shaneware.biz
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Using clang 6.0 to compile a specific file from the godot project is
excessively long.

clang 5.0 compiles this file in around 4 seconds
clang 6.0 compiles the same file in 5842 seconds (yes over 1.5 hours, the
entire project can normally be built in under 700 seconds)

I am using FreeBSD 11-stable, this issue was first noticed on 12-current after
clang6 was added as the base compiler. I see the same issue on FreeBSD 11 using
clang6 from ports.

clang++ --version
FreeBSD clang version 5.0.1 (tags/RELEASE_501/final 320880) (based on LLVM
5.0.1)

clang++60 --version
clang version 6.0.0 (tags/RELEASE_600/final)

This happens with an amd64 target, adding -m32 allows clang6 to compile the
file in a few seconds.

The issue appears to be in the optimisation, using -O0 compiles in a few
seconds while -O1 or higher takes thousands of seconds.

The godot project is a game engine, it can be built as a runtime only or as an
IDE. Building with the IDE enabled bypasses this issue, it only happens with a
runtime only build.

Within the godot project the file is servers/physics/collision_solver_sat.cpp
<a href="https://github.com/godotengine/godot/blob/master/servers/physics/collision_solver_sat.cpp">https://github.com/godotengine/godot/blob/master/servers/physics/collision_solver_sat.cpp</a>

I haven't had any luck compiling this one file outside of the main project, so
the best I can recommend is to start building the port on FreeBSD, stop the
build once the first couple of files have compiled and then manually compile
the specific file.

cd /usr/ports/devel/godot
make
Ctrl-C
cd work/godot-3.0.2-stable
time clang++60 -o servers/physics/collision_solver_sat.x11.opt.64.llvm.o -c
-pipe -g1 -O3 -ffast-math -fstack-protector -fno-strict-aliasing
-DRTAUDIO_ENABLED -pthread -w -DNDEBUG -DZSTD_STATIC_LINKING_ONLY
-DFREETYPE_ENABLED -DRECAST_ENABLED -DSVG_ENABLED -DTYPED_METHOD_BIND
-DTOUCH_ENABLED -DALSA_ENABLED -DOSS_ENABLED -DPULSEAUDIO_ENABLED -DX11_ENABLED
-DUNIX_ENABLED -DOPENGL_ENABLED -DGLES_ENABLED -DPTRCALL_ENABLED
-DGDSCRIPT_ENABLED -DMINIZIP_ENABLED -DXML_ENABLED -DGLAD_ENABLED
-DGLES_OVER_GL -D_THREAD_SAFE -D_REENTRANT -Icore -Icore/math -Ieditor
-Idrivers -I. -I/usr/local/include -I/usr/local/include/freetype2
-I/usr/local/include/libpng16 -Iplatform/x11 -Ithirdparty/zstd
-Ithirdparty/zstd/common -Ithirdparty/rtaudio -Ithirdparty/glad
-Ithirdparty/recastnavigation/Recast
-Ithirdparty/recastnavigation/Recast/Include -Ithirdparty/nanosvg
servers/physics/collision_solver_sat.cpp</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>