mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[ownership] Add a frontend option -disable-ossa-opts to disable ossa based opts for benchmarking purposes.
This commit is contained in:
@@ -53,6 +53,10 @@ public:
|
|||||||
/// Controls whether the SIL ARC optimizations are run.
|
/// Controls whether the SIL ARC optimizations are run.
|
||||||
bool EnableARCOptimizations = true;
|
bool EnableARCOptimizations = true;
|
||||||
|
|
||||||
|
/// Controls whether specific OSSA optimizations are run. For benchmarking
|
||||||
|
/// purposes.
|
||||||
|
bool EnableOSSAOptimizations = true;
|
||||||
|
|
||||||
/// Should we run any SIL performance optimizations
|
/// Should we run any SIL performance optimizations
|
||||||
///
|
///
|
||||||
/// Useful when you want to enable -O LLVM opts but not -O SIL opts.
|
/// Useful when you want to enable -O LLVM opts but not -O SIL opts.
|
||||||
|
|||||||
@@ -254,6 +254,8 @@ def debugger_support : Flag<["-"], "debugger-support">,
|
|||||||
|
|
||||||
def disable_arc_opts : Flag<["-"], "disable-arc-opts">,
|
def disable_arc_opts : Flag<["-"], "disable-arc-opts">,
|
||||||
HelpText<"Don't run SIL ARC optimization passes.">;
|
HelpText<"Don't run SIL ARC optimization passes.">;
|
||||||
|
def disable_ossa_opts : Flag<["-"], "disable-ossa-opts">,
|
||||||
|
HelpText<"Don't run SIL OSSA optimization passes.">;
|
||||||
|
|
||||||
def disable_sil_partial_apply : Flag<["-"], "disable-sil-partial-apply">,
|
def disable_sil_partial_apply : Flag<["-"], "disable-sil-partial-apply">,
|
||||||
HelpText<"Disable use of partial_apply in SIL generation">;
|
HelpText<"Disable use of partial_apply in SIL generation">;
|
||||||
|
|||||||
@@ -844,6 +844,7 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
|
|||||||
Opts.RemoveRuntimeAsserts |= Args.hasArg(OPT_RemoveRuntimeAsserts);
|
Opts.RemoveRuntimeAsserts |= Args.hasArg(OPT_RemoveRuntimeAsserts);
|
||||||
|
|
||||||
Opts.EnableARCOptimizations |= !Args.hasArg(OPT_disable_arc_opts);
|
Opts.EnableARCOptimizations |= !Args.hasArg(OPT_disable_arc_opts);
|
||||||
|
Opts.EnableOSSAOptimizations &= !Args.hasArg(OPT_disable_ossa_opts);
|
||||||
Opts.DisableSILPerfOptimizations |= Args.hasArg(OPT_disable_sil_perf_optzns);
|
Opts.DisableSILPerfOptimizations |= Args.hasArg(OPT_disable_sil_perf_optzns);
|
||||||
Opts.VerifyAll |= Args.hasArg(OPT_sil_verify_all);
|
Opts.VerifyAll |= Args.hasArg(OPT_sil_verify_all);
|
||||||
Opts.DebugSerialization |= Args.hasArg(OPT_sil_debug_serialization);
|
Opts.DebugSerialization |= Args.hasArg(OPT_sil_debug_serialization);
|
||||||
|
|||||||
@@ -772,6 +772,10 @@ struct SemanticARCOpts : SILFunctionTransform {
|
|||||||
void run() override {
|
void run() override {
|
||||||
SILFunction &f = *getFunction();
|
SILFunction &f = *getFunction();
|
||||||
|
|
||||||
|
// Return early if we are not performing OSSA optimizations.
|
||||||
|
if (!f.getModule().getOptions().EnableOSSAOptimizations)
|
||||||
|
return;
|
||||||
|
|
||||||
// Make sure we are running with ownership verification enabled.
|
// Make sure we are running with ownership verification enabled.
|
||||||
assert(f.getModule().getOptions().VerifySILOwnership &&
|
assert(f.getModule().getOptions().VerifySILOwnership &&
|
||||||
"Can not perform semantic arc optimization unless ownership "
|
"Can not perform semantic arc optimization unless ownership "
|
||||||
|
|||||||
@@ -716,6 +716,10 @@ public:
|
|||||||
if (!F->hasOwnership())
|
if (!F->hasOwnership())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// If we are not supposed to perform ossa optimizations, bail.
|
||||||
|
if (!F->getModule().getOptions().EnableOSSAOptimizations)
|
||||||
|
return;
|
||||||
|
|
||||||
LLVM_DEBUG(llvm::dbgs() << "*** DestroyHoisting on function: "
|
LLVM_DEBUG(llvm::dbgs() << "*** DestroyHoisting on function: "
|
||||||
<< F->getName() << " ***\n");
|
<< F->getName() << " ***\n");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user