[PATCH] Move f optimizations to clang_ignored_gcc_optimization_f_Group

Reid Kleckner rnk at google.com
Tue Jul 15 13:20:03 PDT 2014


================
Comment at: include/clang/Driver/Options.td:574
@@ -573,3 +573,3 @@
   HelpText<"Generate calls to instrument function entry and exit">;
-def : Flag<["-"], "fkeep-inline-functions">, Group<clang_ignored_f_Group>;
+def : Flag<["-"], "fkeep-inline-functions">, Group<clang_ignored_gcc_optimization_f_Group>;
 def flat__namespace : Flag<["-"], "flat_namespace">;
----------------
This isn't an optimization flag, IMO.  This is the equivalent of changing all discardable (linkonce / linkonce_odr) globals to non-discardable globals (weak / weak_odr).  I know it's in GCC optimization flag docs, but it's more of a correctness workaround for invalid code.

================
Comment at: include/clang/Driver/Options.td:689
@@ -688,3 +688,3 @@
 def fno_inline : Flag<["-"], "fno-inline">, Group<f_clang_Group>, Flags<[CC1Option]>;
-def : Flag<["-"], "fno-keep-inline-functions">, Group<clang_ignored_f_Group>;
+def : Flag<["-"], "fno-keep-inline-functions">, Group<clang_ignored_gcc_optimization_f_Group>;
 def fno_lax_vector_conversions : Flag<["-"], "fno-lax-vector-conversions">, Group<f_Group>,
----------------
ditto, not optimization.

Actually, while you're at it, can you make this a BooleanFFlag to reduce duplication?

================
Comment at: include/clang/Driver/Options.td:1585-1586
@@ -1584,4 +1584,4 @@
 
-defm align_functions : BooleanFFlag<"align-functions">, Group<clang_ignored_f_Group>;
-def falign_functions_EQ : Joined<["-"], "falign-functions=">, Group<clang_ignored_f_Group>;
+defm align_functions : BooleanFFlag<"align-functions">, Group<clang_ignored_gcc_optimization_f_Group>;
+def falign_functions_EQ : Joined<["-"], "falign-functions=">, Group<clang_ignored_gcc_optimization_f_Group>;
 
----------------
Hm, these are probably easy to implement in LLVM today.  No action needed, though, this change is right.

================
Comment at: test/Driver/clang_f_opts.c:173-199
@@ -172,4 +172,29 @@
 // Test that the warning is displayed on these.
 // RUN: %clang -### -finline-limit=1000 %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING1 %s
 // RUN: %clang -### -finline-limit %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING2 %s
+// RUN: %clang -### -fexpensive-optimizations %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING3 %s
+// RUN: %clang -### -fno-expensive-optimizations %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING4 %s
+// RUN: %clang -### -fno-defer-pop %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING5 %s
+// RUN: %clang -### -finline-functions %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING6 %s
+// RUN: %clang -### -fkeep-inline-functions %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING7 %s
+// RUN: %clang -### -fno-keep-inline-functions %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING8 %s
+// RUN: %clang -### -freorder-blocks %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING9 %s
+// RUN: %clang -### -fprofile-dir=/rand/dir %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING10 %s
+// RUN: %clang -### -fprofile-use %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING11 %s
+// RUN: %clang -### -fprofile-use=/rand/dir %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING12 %s
+// RUN: %clang -### -falign-functions %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING13 %s
+// RUN: %clang -### -falign-functions=1 %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING14 %s
+// RUN: %clang -### -ffloat-store %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING15 %s
+// RUN: %clang -### -fgcse %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING16 %s
+// RUN: %clang -### -fivopts %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING17 %s
+// RUN: %clang -### -fprefetch-loop-arrays %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING18 %s
+// RUN: %clang -### -fprofile-correction %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING19 %s
+// RUN: %clang -### -fprofile-values %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING20 %s
+// RUN: %clang -### -frounding-math %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING21 %s
+// RUN: %clang -### -fschedule-insns %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING22 %s
+// RUN: %clang -### -fsignaling-nans %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING23 %s
+// RUN: %clang -### -fstrength-reduce %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING24 %s
+// RUN: %clang -### -ftracer %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING25 %s
+// RUN: %clang -### -funroll-all-loops %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING26 %s
+// RUN: %clang -### -funswitch-loops %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING27 %s
 // CHECK-WARNING1: optimization flag '-finline-limit=1000' is not supported
----------------
These are lots of subprocess invocations.  You can speed up the test significantly by making this all one compiler invocation along the lines of:

  // RUN: %clang -### %s \
  // RUN:  -fflag \
  // ...
  // RUN: 2>&1 | FileCheck --check-prefix=CHECK-WARNING %s
  // CHECK-WARNING-DAG: optimization flag '-fflag' is not supported
  // ...

http://reviews.llvm.org/D4474






More information about the cfe-commits mailing list