<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 - __config_site concatenation at build time means that clang's include guard heuristic doesn't fire for libc++s __config"
href="https://bugs.llvm.org/show_bug.cgi?id=48733">48733</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>__config_site concatenation at build time means that clang's include guard heuristic doesn't fire for libc++s __config
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nicolasweber@gmx.de
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>After <a href="https://reviews.llvm.org/D80927">https://reviews.llvm.org/D80927</a> we always generate __config_site and then
always prepend it to __config in a build step. That means __config looks like
so
#ifndef _LIBCPP_CONFIG_SITE
#define _LIBCPP_CONFIG_SITE
...
#endif // _LIBCPP_CONFIG_SITE
#ifndef _LIBCPP_CONFIG
#define _LIBCPP_CONFIG
...
#endif // _LIBCPP_CONFIG
clang (and other compilers) has an include guard heuristic that looks for
#ifndef A
#define A
...
#endif // ...
and if it sees this, it handles the file if it was `#pragma once`. libc++s
current setup defeats this optimization.
For n=30, ministat finds a -2.57491% +/- 1.12726% reduction in compile time for
compiling a file that does nothing but #include <vector> if I manually modify
the generated ___config to trigger the optimization (I verified with `-H
-Xclang -print-stats` that the optimization did kick in after editing the
generated file).</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>