<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/61750>61750</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Loading precompiled headers file (.pch) causes simple function int main() {} to compile in 90 sec/4.1 GB
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          yurivict
      </td>
    </tr>
</table>

<pre>
    Please see the attached shar with reproducer.

The headers from the [mlpack](https://github.com/mlpack/mlpack) project cause clang to exhibit the problem.

Please:
1) Install mlpack
2) run the run-make-pch.sh script
3) run the run-consume-pch.sh script

run-consume-pch.sh compiles a simple int main() {} function in 90 sec/4.1 GB because mlpack's pch file is loaded.

The scripts follow how cmake creates pch files. When cmake is used enabling precompiled headers for mlpack.hpp causes all C++ modules to go up in memory/time. This defeats precompiled headers - makes it impossible to use them.

clang-14.0.5
FreeBSD 13.1

[pch.shar.txt](https://github.com/llvm/llvm-project/files/11086028/pch.shar.txt)

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUU82OpDYQfhpzKTUyBrrhwGFJiyhSDpGyUs7GFG1nDbZcZmfn7SMDo9mddBTtxfy4_FV9P5ZE5rEidqzuWX3P5Ba1C93rFsxXo2I2uum1-8OiJARChKgRZIxSaZyAtAzwYqKGgD64aVMYcsbvjH861s8aQaOcMBDMwS37cVb3i_VSfWH1nYlGx-iJlZ-YGJgYHibqbcyVW5gYzrL3lxZ8cH-jiqDkRgjKyvUB0QF-02Y0ccf3wY0Wlx8GORikLvtnkaB-WylKa-EE3zdE2gjbugOFbb0s8gtevNI5aSAVjI9HYfmxULmVtuVp7bE-KVJu8cYigQQyi7cIZo2wSLMy0aQG7Naz2x3mbVXRuBXMCi0HQsXEUOUF_NrDiIcUbxLdCLzSMJuERmCdnHD6lynHeASzs9a9gHYvoBJVUAFlxHcMyuEvjeu5awg2wglwlaM16wN8wJPE9G60C-c0ufb-cIogKf0LEz0TPSxu2hLt6ODhYPOJ14KLC69MDNEsmMNnbQgmnFFGetrlAmkiAhPBLN4RmdFiQkxiRP3B_z0ol6LKeV4ff4aA2P95h6LMi-8rWd0f7siQx2_xfzNq7de3x-UMJxPDLh0TQ1Hw5sqTmcMPqKI9umVTV05t2coMu-J6a9umqiuR6W6sm0Jh217bqeaqnAteFFU9V7NC0Up-zUwnuCh5KRp-FUKIXKGoblWjVFk1ik8Vqzgu0tg8jZa78MgM0YbdtbjVPLNyREtvtz50-_zj9iBWcWso0vuxaKLF7ncnp_90PIWNiSb3SqfYnpafmf4uvc_CHd3bPXgS72wLtvtp9XeiSf6d6z8BAAD__4AUlHw">