From b71f6aa33c1aa2cd4521198356703f2788c5397c Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Wed, 24 Apr 2013 18:09:54 +0000 Subject: [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 llvm-svn: 180204 --- clang/test/Driver/Ofast.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 clang/test/Driver/Ofast.c (limited to 'clang/test') diff --git a/clang/test/Driver/Ofast.c b/clang/test/Driver/Ofast.c new file mode 100644 index 00000000000..bceeb8f5fe3 --- /dev/null +++ b/clang/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 -- cgit v1.2.3