[PATCH] D20444: [OpenCL] Include opencl-c.h by default as a clang module
Yaxun Liu via cfe-commits
cfe-commits at lists.llvm.org
Fri May 27 13:38:41 PDT 2016
yaxunl marked an inline comment as done.
================
Comment at: include/clang/Basic/LangOptions.def:220
@@ -219,3 +219,3 @@
ENUM_LANGOPT(AddressSpaceMapMangling , AddrSpaceMapMangling, 2, ASMM_Target, "OpenCL address space map mangling mode")
-
+LANGOPT(IncludeDefaultHeader, 1, 0, "Include default header file for OpenCL")
BENIGN_LANGOPT(DelayedTemplateParsing , 1, 0, "delayed template parsing")
----------------
I agree and has made the change.
The module caches AST of the header file, which is essentially the same thing as PCH.
I checked a typical OpenCL progam. Without including header,
---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---
0.0160 (100.0%) 0.0080 (100.0%) 0.0240 (100.0%) 0.0211 (100.0%) Clang front-end timer
0.0160 (100.0%) 0.0080 (100.0%) 0.0240 (100.0%) 0.0211 (100.0%) Total
With header but without module caching,
---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---
0.2160 (100.0%) 0.0120 (100.0%) 0.2280 (100.0%) 0.2271 (100.0%) Clang front-end timer
0.2160 (100.0%) 0.0120 (100.0%) 0.2280 (100.0%) 0.2271 (100.0%) Total
With header and module caching,
---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---
0.0160 (100.0%) 0.0080 (100.0%) 0.0240 (100.0%) 0.0222 ( 93.6%) Clang front-end timer
0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0008 ( 3.5%) Reading modules
0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0007 ( 2.9%) Loading /home/yaxunl/llvm-tot/llvm/tools/clang/test/CodeGenOpenCL/./JJHF9CF78G8Z/opencl_c-3RXFI66A6CUM7.pcm
0.0160 (100.0%) 0.0080 (100.0%) 0.0240 (100.0%) 0.0237 (100.0%) Total
So the caching is very effective and essentially makes the header loading time to be ignored.
http://reviews.llvm.org/D20444
More information about the cfe-commits
mailing list