Frontend: Add OFast flag

The optimization level -OFast disables runtime checks (overflow, type checks)
and assertions.

rdar://16458612

Swift SVN r16474
This commit is contained in:
Arnold Schwaighofer
2014-04-17 22:05:44 +00:00
parent 45ffb41adf
commit 97892b1cfa
3 changed files with 34 additions and 0 deletions

View File

@@ -684,6 +684,13 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
if (A->getOption().matches(OPT_O0)) {
IRGenOpts.OptLevel = 0;
} else if (A->getOption().matches(OPT_OFast)) {
// Set the maximum optimization level and remove all runtime checks.
IRGenOpts.OptLevel = MaxLevel;
// Unchecked casts.
IRGenOpts.DisableAllRuntimeChecks = true;
// Removal of cond_fail (overflow on binary operations).
Opts.RemoveRuntimeAsserts = true;
} else {
unsigned OptLevel;
if (StringRef(A->getValue()).getAsInteger(10, OptLevel) ||