https://bugs.llvm.org/show_bug.cgi?id=48733
Bug ID: 48733
Summary: __config_site concatenation at build time means that
clang's include guard heuristic doesn't fire for
libc++s __config
Product: libc++
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: All Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
After https://reviews.llvm.org/D80927 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).
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs