Rename -Ofast to -Ounchecked.

<rdar://problem/17202004>

Swift SVN r20454
This commit is contained in:
Jordan Rose
2014-07-24 01:12:56 +00:00
parent 309d00706c
commit 836c9d6eb4
8 changed files with 25 additions and 15 deletions

View File

@@ -303,7 +303,7 @@ we can do this check in O(1) because the source holds a known buffer
type. Rather than incur O(N) checking for the other cases, the new type. Rather than incur O(N) checking for the other cases, the new
intermediate object is marked for deferred checking, and all element intermediate object is marked for deferred checking, and all element
accesses through that object are dynamically typechecked, with a trap accesses through that object are dynamically typechecked, with a trap
upon failure (except in ``-Ofast`` builds). upon failure (except in ``-Ounchecked`` builds).
When the resulting array is later up-cast (other than to a type that When the resulting array is later up-cast (other than to a type that
can be validated in O(1) by checking the type of the underlying can be validated in O(1) by checking the type of the underlying

View File

@@ -229,7 +229,10 @@ def Onone : Flag<["-"], "Onone">, Group<O_Group>, Flags<[FrontendOption]>,
Alias<O0>; Alias<O0>;
def O : Joined<["-"], "O">, Group<O_Group>, Flags<[FrontendOption]>; def O : Joined<["-"], "O">, Group<O_Group>, Flags<[FrontendOption]>;
def Ofast : Flag<["-"], "Ofast">, Group<O_Group>, Flags<[FrontendOption]>; def Ounchecked : Flag<["-"], "Ounchecked">, Group<O_Group>,
Flags<[FrontendOption]>,
HelpText<"Compile with optimizations and remove runtime safety checks">;
def Ofast : Flag<["-"], "Ofast">, Group<O_Group>, Alias<Ounchecked>;
// Assert configuration identifiers. // Assert configuration identifiers.
def AssertConfig : Separate<["-"], "assert-config">, def AssertConfig : Separate<["-"], "assert-config">,

View File

@@ -730,7 +730,7 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
if (A->getOption().matches(OPT_O0)) { if (A->getOption().matches(OPT_O0)) {
IRGenOpts.OptLevel = 0; IRGenOpts.OptLevel = 0;
} else if (A->getOption().matches(OPT_Ofast)) { } else if (A->getOption().matches(OPT_Ounchecked)) {
// Set the maximum optimization level and remove all runtime checks. // Set the maximum optimization level and remove all runtime checks.
IRGenOpts.OptLevel = MaxLevel; IRGenOpts.OptLevel = MaxLevel;
// Removal of cond_fail (overflow on binary operations). // Removal of cond_fail (overflow on binary operations).
@@ -776,12 +776,12 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
Opts.AssertConfig = SILOptions::DisableReplacement; Opts.AssertConfig = SILOptions::DisableReplacement;
} else if (Opts.AssertConfig == SILOptions::Debug) { } else if (Opts.AssertConfig == SILOptions::Debug) {
// Set the assert configuration according to the optimization level if it // Set the assert configuration according to the optimization level if it
// has not been set by the "Ofast" flag. // has not been set by the -Ounchecked flag.
Opts.AssertConfig = Opts.AssertConfig =
IRGenOpts.OptLevel > 0 ? SILOptions::Release : SILOptions::Debug; IRGenOpts.OptLevel > 0 ? SILOptions::Release : SILOptions::Debug;
} }
// OFast might also set removal of runtime asserts (cond_fail). // -Ounchecked might also set removal of runtime asserts (cond_fail).
Opts.RemoveRuntimeAsserts |= Args.hasArg(OPT_remove_runtime_asserts); Opts.RemoveRuntimeAsserts |= Args.hasArg(OPT_remove_runtime_asserts);
Opts.EnableARCOptimizations |= !Args.hasArg(OPT_disable_arc_opts); Opts.EnableARCOptimizations |= !Args.hasArg(OPT_disable_arc_opts);

View File

@@ -2,7 +2,7 @@
// RUN: %swift -O0 -emit-sil %s 2>&1 | FileCheck %s --check-prefix=DEBUG // RUN: %swift -O0 -emit-sil %s 2>&1 | FileCheck %s --check-prefix=DEBUG
// RUN: %swift -O3 -emit-sil %s 2>&1 | FileCheck %s --check-prefix=RELEASE // RUN: %swift -O3 -emit-sil %s 2>&1 | FileCheck %s --check-prefix=RELEASE
// RUN: %swift -O -emit-sil %s 2>&1 | FileCheck %s --check-prefix=RELEASE // RUN: %swift -O -emit-sil %s 2>&1 | FileCheck %s --check-prefix=RELEASE
// RUN: %swift -Ofast -emit-sil %s 2>&1 | FileCheck %s --check-prefix=FAST // RUN: %swift -Ounchecked -emit-sil %s 2>&1 | FileCheck %s --check-prefix=UNCHECKED
// REQUIRES: optimized_stdlib // REQUIRES: optimized_stdlib
@@ -85,12 +85,12 @@ func test_partial_safety_check(x: Int, y: Int) -> Int {
// RELEASE: cond_fail %[[V2]] // RELEASE: cond_fail %[[V2]]
// RELEASE: return // RELEASE: return
// In fast mode remove library precondition checks. // In unchecked mode remove library precondition checks.
// FAST-LABEL: _TF19OptimizationOptions23test_precondition_checkFTSiSi_Si // UNCHECKED-LABEL: _TF19OptimizationOptions23test_precondition_checkFTSiSi_Si
// FAST-NOT: "fatal error" // UNCHECKED-NOT: "fatal error"
// FAST-NOT: builtin_function_ref "int_trap" // UNCHECKED-NOT: builtin_function_ref "int_trap"
// FAST-NOT: unreachable // UNCHECKED-NOT: unreachable
// FAST: return // UNCHECKED: return
// Partial safety checks. // Partial safety checks.

View File

@@ -1,5 +1,5 @@
// We were missing target transform info and not vectorizing the loop below. // We were missing target transform info and not vectorizing the loop below.
// RUN: %swift -target x86_64-apple-macosx10.9 -Ofast %s -emit-ir | FileCheck %s // RUN: %swift -target x86_64-apple-macosx10.9 -Ounchecked %s -emit-ir | FileCheck %s
// REQUIRES: X86 // REQUIRES: X86
// CHECK: xor <2 x i64> // CHECK: xor <2 x i64>

View File

@@ -1,4 +1,4 @@
// RUN: %swift %s -emit-sil -Ofast | sil-opt -verify // RUN: %swift %s -emit-sil -Ounchecked | sil-opt -verify
// XFAIL: * // XFAIL: *
// XFAIL due to <rdar://problem/17758203> and <rdar://problem/17781140> // XFAIL due to <rdar://problem/17758203> and <rdar://problem/17781140>
var W = [UInt32](count: 16, repeatedValue: 0) var W = [UInt32](count: 16, repeatedValue: 0)

View File

@@ -4,7 +4,7 @@
// RUN: xcrun -sdk %target-sdk-name clang++ -arch %target-cpu %S/Inputs/ReturnNil/ReturnNil.m -c -o %t/ReturnNil.o -g // RUN: xcrun -sdk %target-sdk-name clang++ -arch %target-cpu %S/Inputs/ReturnNil/ReturnNil.m -c -o %t/ReturnNil.o -g
// RUN: %target-build-swift %s -I %S/Inputs/ReturnNil/ -Xlinker %t/CatchCrashes.o -Xlinker %t/ReturnNil.o -o %t/OptionalTraps_Debug // RUN: %target-build-swift %s -I %S/Inputs/ReturnNil/ -Xlinker %t/CatchCrashes.o -Xlinker %t/ReturnNil.o -o %t/OptionalTraps_Debug
// RUN: %target-build-swift %s -I %S/Inputs/ReturnNil/ -Xlinker %t/CatchCrashes.o -Xlinker %t/ReturnNil.o -o %t/OptionalTraps_Release -O // RUN: %target-build-swift %s -I %S/Inputs/ReturnNil/ -Xlinker %t/CatchCrashes.o -Xlinker %t/ReturnNil.o -o %t/OptionalTraps_Release -O
// RUN: %target-build-swift %s -I %S/Inputs/ReturnNil/ -Xlinker %t/CatchCrashes.o -Xlinker %t/ReturnNil.o -o %t/OptionalTraps_Fast -Ofast // RUN: %target-build-swift %s -I %S/Inputs/ReturnNil/ -Xlinker %t/CatchCrashes.o -Xlinker %t/ReturnNil.o -o %t/OptionalTraps_Fast -Ounchecked
// //
// RUN: %target-run %t/OptionalTraps_Debug UnwrapNone1 2>&1 | FileCheck %s -check-prefix=CHECK // RUN: %target-run %t/OptionalTraps_Debug UnwrapNone1 2>&1 | FileCheck %s -check-prefix=CHECK
// RUN: %target-run %t/OptionalTraps_Release UnwrapNone1 2>&1 | FileCheck %s -check-prefix=CHECK // RUN: %target-run %t/OptionalTraps_Release UnwrapNone1 2>&1 | FileCheck %s -check-prefix=CHECK

View File

@@ -52,6 +52,13 @@ Latest
import UIKit.UIGestureRecognizerSubclass import UIKit.UIGestureRecognizerSubclass
* The numeric optimization levels -O[0-3] have been removed in favor of the
named levels -Onone and -O.
* The -Ofast optimization flag has been renamed to -Ounchecked. We will accept
both names for now and remove -Ofast in a later build.
2014-07-21 2014-07-21
---------- ----------