[PATCH] D20444: [OpenCL] Include opencl-c.h by default as a clang module

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 6 08:51:18 PDT 2016


yaxunl added inline comments.

================
Comment at: test/Headers/opencl-c-header.cl:50
@@ +49,3 @@
+// RUN: %clang_cc1 -cc1 -triple spir-unknown-unknown -emit-llvm -o - -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash %s | FileCheck %s
+// RUN: diff %t/1_0.pcm %t/opencl_c.pcm
+// RUN: rm %t/opencl_c.pcm
----------------
Anastasia wrote:
> Sam, what was the aim of this test?
> 
> I was just wondering if we should instead check that the file is exactly the same i.e. hasn't been overwritten with exactly the same content?
This checks whether the content has changed, which is the same approach used by test/Modules/fmodules-validate-once-per-build-session.c to make sure a module is not re-compiled.

It seems there is no good way otherwise. stat -c %Y filename can get the modification time but it is in seconds, which is not accurate enough.

================
Comment at: test/Headers/opencl-c-header.cl:53-54
@@ +52,4 @@
+
+// ===
+// Compile for OpenCL 2.0 for the first time. The module should change.
+// RUN: %clang_cc1 -cc1 -triple spir-unknown-unknown -emit-llvm -o - -cl-std=CL2.0 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash %s | FileCheck --check-prefix=CHECK20 %s
----------------
Anastasia wrote:
> Indeed PCH size is an issue. I don't quite get why it expands from the original source code size by a factor or 2. Something to look at!
I can take a look why the PCH size is much larger than the header file itself.

================
Comment at: test/Headers/opencl-c-header.cl:70
@@ +69,3 @@
+// RUN: %clang_cc1 -cc1 -triple amdgcn--amdhsa -emit-llvm -o - -cl-std=CL2.0  -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s | FileCheck --check-prefix=CHECK20 %s
+// RUN: %clang_cc1 -cc1 -triple spir-unknown-unknown -emit-llvm -o - -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s | FileCheck %s
+// RUN: %clang_cc1 -cc1 -triple spir-unknown-unknown -emit-llvm -o - -cl-std=CL2.0 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s | FileCheck --check-prefix=CHECK20 %s
----------------
Anastasia wrote:
> This line seems exactly the same as line 67.
Right. The first compilation generates the module and the second compilation uses the cached module. The module is compiled for different OpenCL version and triple to make sure the cached module still works.


http://reviews.llvm.org/D20444





More information about the cfe-commits mailing list