Add -cl-fast-relaxed-math into incompatible opts and fix the PreprocessorOptions bug
authorJunyan He <junyan.he@linux.intel.com>
Wed, 15 Jan 2014 07:34:12 +0000 (15:34 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Thu, 16 Jan 2014 02:35:54 +0000 (10:35 +0800)
Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
backend/src/backend/program.cpp

index 284a755..c0358b3 100644 (file)
@@ -566,7 +566,7 @@ namespace gbe {
     clang::LangOptions & lang_opts = Clang.getLangOpts();
     lang_opts.OpenCL = 1;
 
-    clang::PreprocessorOptions prep_opt = Clang.getPreprocessorOpts();
+    clang::PreprocessorOptions& prep_opt = Clang.getPreprocessorOpts();
     prep_opt.DisablePCHValidation = 1;
 
     //llvm flags need command line parsing to take effect
@@ -697,9 +697,14 @@ namespace gbe {
 
     if(options) {
       char *p;
+      /* FIXME: Though we can disable the pch valid check, and load pch successfully,
+         but these language opts and pre-defined macro will still generate the diag msg
+         to the diag engine of the Clang and cause the Clang to report error.
+         We filter them all here to avoid these. */
       const char * incompatible_opts[] = {
           "-cl-single-precision-constant",
 //        "-cl-denorms-are-zero",
+          "-cl-fast-relaxed-math",
           "-cl-std=",
       };
       const char * incompatible_defs[] = {