Disable runtime exclusivity checks with -Ounchecked.

If runtime asserts are disabled in general, also disable runtime
exclusivity checks unless explicitly requested.

-Ounchecked is an unsupported benchmarking mode, but, if used, it
should disable all runtime assertions. Exclusivity checks are no more
essential than integer overflow or bounds checks.
This commit is contained in:
Andrew Trick
2018-11-08 13:36:30 -08:00
parent 2645a74be8
commit f836e76857
4 changed files with 44 additions and 3 deletions

View File

@@ -771,6 +771,11 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
Opts.VerifyExclusivity
= A->getOption().matches(OPT_enable_verify_exclusivity);
}
// If runtime asserts are disabled in general, also disable runtime
// exclusivity checks unless explicitly requested.
if (Opts.RemoveRuntimeAsserts)
Opts.EnforceExclusivityDynamic = false;
if (const Arg *A = Args.getLastArg(options::OPT_enforce_exclusivity_EQ)) {
parseExclusivityEnforcementOptions(A, Opts, Diags);
}