[cfe-commits] r120876 - in /cfe/trunk: include/clang/Driver/CC1Options.td lib/Frontend/CompilerInvocation.cpp test/CodeGen/ext-vector-shuffle.c

Peter Collingbourne peter at pcc.me.uk
Fri Dec 3 17:50:45 PST 2010


Author: pcc
Date: Fri Dec  3 19:50:45 2010
New Revision: 120876

URL: http://llvm.org/viewvc/llvm-project?rev=120876&view=rev
Log:
Implement -cl-opt-disable

Modified:
    cfe/trunk/include/clang/Driver/CC1Options.td
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp
    cfe/trunk/test/CodeGen/ext-vector-shuffle.c

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=120876&r1=120875&r2=120876&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Fri Dec  3 19:50:45 2010
@@ -592,3 +592,10 @@
   HelpText<"Print macro definitions in -E mode in addition to normal output">;
 def H : Flag<"-H">,
   HelpText<"Show header includes and nesting depth">;
+
+//===----------------------------------------------------------------------===//
+// OpenCL Options
+//===----------------------------------------------------------------------===//
+
+def cl_opt_disable : Flag<"-cl-opt-disable">,
+  HelpText<"OpenCL only. This option disables all optimizations. The default is optimizations are enabled.">;

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=120876&r1=120875&r2=120876&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri Dec  3 19:50:45 2010
@@ -774,8 +774,12 @@
 
 static unsigned getOptimizationLevel(ArgList &Args, InputKind IK,
                                      Diagnostic &Diags) {
+  unsigned DefaultOpt = 0;
+  if (IK == IK_OpenCL && !Args.hasArg(OPT_cl_opt_disable))
+    DefaultOpt = 2;
   // -Os implies -O2
-  return Args.hasArg(OPT_Os) ? 2 : Args.getLastArgIntValue(OPT_O, 0, Diags);
+  return Args.hasArg(OPT_Os) ? 2 :
+    Args.getLastArgIntValue(OPT_O, DefaultOpt, Diags);
 }
 
 static void ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args,

Modified: cfe/trunk/test/CodeGen/ext-vector-shuffle.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ext-vector-shuffle.c?rev=120876&r1=120875&r2=120876&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/ext-vector-shuffle.c (original)
+++ cfe/trunk/test/CodeGen/ext-vector-shuffle.c Fri Dec  3 19:50:45 2010
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 %s -x cl -emit-llvm -o - | not grep 'extractelement'
-// RUN: %clang_cc1 %s -x cl -emit-llvm -o - | not grep 'insertelement'
-// RUN: %clang_cc1 %s -x cl -emit-llvm -o - | grep 'shufflevector'
+// RUN: %clang_cc1 %s -x cl -cl-opt-disable -emit-llvm -o - | not grep 'extractelement'
+// RUN: %clang_cc1 %s -x cl -cl-opt-disable -emit-llvm -o - | not grep 'insertelement'
+// RUN: %clang_cc1 %s -x cl -cl-opt-disable -emit-llvm -o - | grep 'shufflevector'
 
 typedef __attribute__(( ext_vector_type(2) )) float float2;
 typedef __attribute__(( ext_vector_type(4) )) float float4;





More information about the cfe-commits mailing list