aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2013-04-24 18:09:54 +0000
committerChad Rosier <mcrosier@apple.com>2013-04-24 18:09:54 +0000
commitb82e117e4af1062b9f0d1aab89abf4aa804558f1 (patch)
treead3bdc95ab05fc861302f79fa849457aa15dd2df /test
parent0127b3f60b5bf7b8caed8426b8bd77c4a019a286 (diff)
[driver] Improve the implementation of the -Ofast option.
Specifically, allow the flags that fall under this umbrella (i.e., -O3, -ffast-math, and -fstrict-aliasing) to be overridden/disabled with the individual -O[0|1|2|s|z]/-fno- flags. This also fixes the handling of various floating point optimization flags that are modified by -ffast-math (and thus -Ofast as well). Part of rdar://13622687 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180204 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Driver/Ofast.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/Driver/Ofast.c b/test/Driver/Ofast.c
new file mode 100644
index 0000000000..bceeb8f5fe
--- /dev/null
+++ b/test/Driver/Ofast.c
@@ -0,0 +1,20 @@
+// 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 -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
+
+// CHECK-OFAST: -cc1
+// CHECK-OFAST-NOT: -relaxed-aliasing
+// CHECK-OFAST: -ffast-math
+// CHECK-OFAST: -Ofast
+
+// 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-STRICT-ALIASING: -cc1
+// CHECK-OFAST-NO-STRICT-ALIASING: -relaxed-aliasing
+// CHECK-OFAST-NO-STRICT-ALIASING: -ffast-math
+// CHECK-OFAST-NO-STRICT-ALIASING: -Ofast