mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add _isFast predicate that is true at Ofast
We want to support three configurations: * Debug (-Onone, -O0): user assertions, library precondition checks, runtime checks enabled and verbose. * Release (-O): library precondition checks, runtime checks enabled but succinct (trap). * Fast (-Ofast): all checks off. The _isFast predicate will allow to write standard library functions to support this plan. This commit changes fatal() to differentiate between the three modes. Support for rdar://16477198 Swift SVN r17697
This commit is contained in:
@@ -694,6 +694,7 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
|
||||
}
|
||||
|
||||
// Parse the optimization level.
|
||||
Opts.AssertConfig = SILOptions::Debug;
|
||||
if (const Arg *A = Args.getLastArg(OPT_O_Group)) {
|
||||
// The maximum optimization level we currently support.
|
||||
unsigned MaxLevel = 3;
|
||||
@@ -707,6 +708,7 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
|
||||
IRGenOpts.DisableAllRuntimeChecks = true;
|
||||
// Removal of cond_fail (overflow on binary operations).
|
||||
Opts.RemoveRuntimeAsserts = true;
|
||||
Opts.AssertConfig = SILOptions::Fast;
|
||||
} else if (!StringRef(A->getValue()).size()) {
|
||||
// -O is an alias to -O3.
|
||||
IRGenOpts.OptLevel = MaxLevel;
|
||||
@@ -736,6 +738,8 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
|
||||
Opts.AssertConfig = SILOptions::Debug;
|
||||
} else if (Configuration == "Release") {
|
||||
Opts.AssertConfig = SILOptions::Release;
|
||||
} else if (Configuration == "Fast") {
|
||||
Opts.AssertConfig = SILOptions::Fast;
|
||||
} else {
|
||||
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_value,
|
||||
A->getAsString(Args), A->getValue());
|
||||
@@ -745,8 +749,9 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
|
||||
// Disable assertion configuration replacement when we build the standard
|
||||
// library.
|
||||
Opts.AssertConfig = SILOptions::DisableReplacement;
|
||||
} else {
|
||||
// Set the assert configuration according to the optimization level.
|
||||
} else if (Opts.AssertConfig == SILOptions::Debug) {
|
||||
// Set the assert configuration according to the optimization level if it
|
||||
// has not been set by the "Ofast" flag.
|
||||
Opts.AssertConfig =
|
||||
IRGenOpts.OptLevel > 0 ? SILOptions::Release : SILOptions::Debug;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user