r180206 - [driver] Put -fvectorize under the -Ofast umbrella flag.

Chad Rosier mcrosier at apple.com
Wed Apr 24 11:29:59 PDT 2013


Author: mcrosier
Date: Wed Apr 24 13:29:59 2013
New Revision: 180206

URL: http://llvm.org/viewvc/llvm-project?rev=180206&view=rev
Log:
[driver] Put -fvectorize under the -Ofast umbrella flag.
Part of rdar://13622687

Modified:
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/Ofast.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=180206&r1=180205&r2=180206&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Apr 24 13:29:59 2013
@@ -3284,8 +3284,13 @@ void Clang::ConstructJob(Compilation &C,
                    false))
     CmdArgs.push_back("-fasm-blocks");
 
+  // If -Ofast is the optimization level, then -fvectorize should be enabled.
+  // This alias option is being used to simplify the hasFlag logic.
+  OptSpecifier VectorizeAliasOption = OFastEnabled ? options::OPT_Ofast :
+    options::OPT_fvectorize;
+
   // -fvectorize is default.
-  if (Args.hasFlag(options::OPT_fvectorize,
+  if (Args.hasFlag(options::OPT_fvectorize, VectorizeAliasOption,
                    options::OPT_fno_vectorize, true)) {
     CmdArgs.push_back("-backend-option");
     CmdArgs.push_back("-vectorize-loops");

Modified: cfe/trunk/test/Driver/Ofast.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Ofast.c?rev=180206&r1=180205&r2=180206&view=diff
==============================================================================
--- cfe/trunk/test/Driver/Ofast.c (original)
+++ cfe/trunk/test/Driver/Ofast.c Wed Apr 24 13:29:59 2013
@@ -1,20 +1,31 @@
 // RUN: %clang -Ofast -### %s 2>&1 | FileCheck -check-prefix=CHECK-OFAST %s
 // RUN: %clang -fno-fast-math -Ofast -### %s 2>&1 | FileCheck -check-prefix=CHECK-OFAST %s
 // RUN: %clang -fno-strict-aliasing -Ofast -### %s 2>&1 | FileCheck -check-prefix=CHECK-OFAST %s
+// RUN: %clang -fno-vectorize -Ofast -### %s 2>&1 | FileCheck -check-prefix=CHECK-OFAST %s
 // RUN: %clang -Ofast -fno-fast-math -### %s 2>&1 | FileCheck -check-prefix=CHECK-OFAST-NO-FAST-MATH %s
 // RUN: %clang -Ofast -fno-strict-aliasing -### %s 2>&1 | FileCheck -check-prefix=CHECK-OFAST-NO-STRICT-ALIASING %s
+// RUN: %clang -Ofast -fno-vectorize -### %s 2>&1 | FileCheck -check-prefix=CHECK-OFAST-NO-VECTORIZE %s
 
 // CHECK-OFAST: -cc1
 // CHECK-OFAST-NOT: -relaxed-aliasing
 // CHECK-OFAST: -ffast-math
 // CHECK-OFAST: -Ofast
+// CHECK-OFAST: -vectorize-loops
 
 // CHECK-OFAST-NO-FAST-MATH: -cc1
 // CHECK-OFAST-NO-FAST-MATH-NOT: -relaxed-aliasing
 // CHECK-OFAST-NO-FAST-MATH-NOT: -ffast-math
 // CHECK-OFAST-NO-FAST-MATH: -Ofast
+// CHECK-OFAST-NO-FAST-MATH: -vectorize-loops
 
 // CHECK-OFAST-NO-STRICT-ALIASING: -cc1
 // CHECK-OFAST-NO-STRICT-ALIASING: -relaxed-aliasing
 // CHECK-OFAST-NO-STRICT-ALIASING: -ffast-math
 // CHECK-OFAST-NO-STRICT-ALIASING: -Ofast
+// CHECK-OFAST-NO-STRICT-ALIASING: -vectorize-loops
+
+// CHECK-OFAST-NO-VECTORIZE: -cc1
+// CHECK-OFAST-NO-VECTORIZE-NOT: -relaxed-aliasing
+// CHECK-OFAST-NO-VECTORIZE: -ffast-math
+// CHECK-OFAST-NO-VECTORIZE: -Ofast
+// CHECK-OFAST-NO-VECTORIZE-NOT: -vectorize-loops





More information about the cfe-commits mailing list