mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Revert "Verify SIL modules at the beginning and at the end of the SIL optimization pipelines, if -sil-verify-all is provided"
This reverts commit r31863, which was committed by mistake. Swift SVN r31864
This commit is contained in:
@@ -315,7 +315,7 @@ class CompilerInstance {
|
||||
|
||||
SourceFile *PrimarySourceFile = nullptr;
|
||||
|
||||
void createSILModule();
|
||||
void createSILModule(bool WholeModule = false);
|
||||
void setPrimarySourceFile(SourceFile *SF);
|
||||
|
||||
public:
|
||||
|
||||
@@ -232,8 +232,9 @@ public:
|
||||
/// \brief Create and return an empty SIL module that we can
|
||||
/// later parse SIL bodies directly into, without converting from an AST.
|
||||
static std::unique_ptr<SILModule> createEmptyModule(Module *M,
|
||||
SILOptions &Options) {
|
||||
return std::unique_ptr<SILModule>(new SILModule(M, Options, M, false));
|
||||
SILOptions &Options,
|
||||
bool WholeModule = false) {
|
||||
return std::unique_ptr<SILModule>(new SILModule(M, Options, M, WholeModule));
|
||||
}
|
||||
|
||||
/// Get the Swift module associated with this SIL module.
|
||||
|
||||
@@ -34,10 +34,11 @@
|
||||
|
||||
using namespace swift;
|
||||
|
||||
void CompilerInstance::createSILModule() {
|
||||
void CompilerInstance::createSILModule(bool WholeModule) {
|
||||
assert(MainModule && "main module not created yet");
|
||||
TheSILModule = SILModule::createEmptyModule(getMainModule(),
|
||||
Invocation.getSILOptions());
|
||||
Invocation.getSILOptions(),
|
||||
WholeModule);
|
||||
}
|
||||
|
||||
void CompilerInstance::setPrimarySourceFile(SourceFile *SF) {
|
||||
@@ -233,7 +234,8 @@ void CompilerInstance::performSema() {
|
||||
if (Kind == InputFileKind::IFK_SIL) {
|
||||
assert(BufferIDs.size() == 1);
|
||||
assert(MainBufferID != NO_SUCH_BUFFER);
|
||||
createSILModule();
|
||||
// Assume WMO, if a -primary-file option was not provided.
|
||||
createSILModule(!options.PrimaryInput.hasValue());
|
||||
modImpKind = SourceFile::ImplicitModuleImportKind::None;
|
||||
} else if (Invocation.getParseStdlib()) {
|
||||
modImpKind = SourceFile::ImplicitModuleImportKind::Builtin;
|
||||
|
||||
@@ -64,10 +64,6 @@ static void registerAnalysisPasses(SILPassManager &PM) {
|
||||
}
|
||||
|
||||
bool swift::runSILDiagnosticPasses(SILModule &Module) {
|
||||
// Verify the module, if required.
|
||||
if (Module.getOptions().VerifyAll)
|
||||
Module.verify();
|
||||
|
||||
// If we parsed a .sil file that is already in canonical form, don't rerun
|
||||
// the diagnostic passes.
|
||||
if (Module.getStage() == SILStage::Canonical)
|
||||
@@ -118,13 +114,6 @@ bool swift::runSILDiagnosticPasses(SILModule &Module) {
|
||||
PM.runOneIteration();
|
||||
}
|
||||
|
||||
// Verify the module, if required.
|
||||
if (Module.getOptions().VerifyAll)
|
||||
Module.verify();
|
||||
else {
|
||||
DEBUG(Module.verify());
|
||||
}
|
||||
|
||||
// If errors were produced during SIL analysis, return true.
|
||||
return Ctx.hadError();
|
||||
}
|
||||
@@ -225,10 +214,6 @@ void AddSSAPasses(SILPassManager &PM, OptimizationLevelKind OpLevel) {
|
||||
|
||||
|
||||
void swift::runSILOptimizationPasses(SILModule &Module) {
|
||||
// Verify the module, if required.
|
||||
if (Module.getOptions().VerifyAll)
|
||||
Module.verify();
|
||||
|
||||
if (Module.getOptions().DebugSerialization) {
|
||||
SILPassManager PM(&Module);
|
||||
registerAnalysisPasses(PM);
|
||||
@@ -347,19 +332,10 @@ void swift::runSILOptimizationPasses(SILModule &Module) {
|
||||
PM.runOneIteration();
|
||||
}
|
||||
|
||||
// Verify the module, if required.
|
||||
if (Module.getOptions().VerifyAll)
|
||||
Module.verify();
|
||||
else {
|
||||
DEBUG(Module.verify());
|
||||
}
|
||||
}
|
||||
|
||||
void swift::runSILPassesForOnone(SILModule &Module) {
|
||||
// Verify the module, if required.
|
||||
if (Module.getOptions().VerifyAll)
|
||||
Module.verify();
|
||||
|
||||
SILPassManager PM(&Module, "Onone");
|
||||
registerAnalysisPasses(PM);
|
||||
|
||||
@@ -378,13 +354,6 @@ void swift::runSILPassesForOnone(SILModule &Module) {
|
||||
PM.addExternalDefsToDecls();
|
||||
|
||||
PM.runOneIteration();
|
||||
|
||||
// Verify the module, if required.
|
||||
if (Module.getOptions().VerifyAll)
|
||||
Module.verify();
|
||||
else {
|
||||
DEBUG(Module.verify());
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-swift-frontend -emit-ir %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-cpu %s
|
||||
// RUN: %target-swift-frontend -primary-file %s -emit-ir| FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-cpu %s
|
||||
|
||||
// REQUIRES: CPU=i386_or_x86_64
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-swift-frontend -g -emit-ir %s | FileCheck %s
|
||||
// RUN: %target-swift-frontend -primary-file %s -g -emit-ir | FileCheck %s
|
||||
|
||||
import Builtin
|
||||
import Swift
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-swift-frontend %s -gnone -emit-ir | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
|
||||
// RUN: %target-swift-frontend -primary-file %s -gnone -emit-ir | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
|
||||
|
||||
// REQUIRES: CPU=x86_64
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-swift-frontend %s -emit-ir | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
|
||||
// RUN: %target-swift-frontend -primary-file %s -emit-ir | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
|
||||
// REQUIRES: executable_test
|
||||
|
||||
sil_stage canonical
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-swift-frontend %s -O -emit-ir | FileCheck %s
|
||||
// RUN: %target-swift-frontend -primary-file %s -O -emit-ir | FileCheck %s
|
||||
|
||||
sil_stage canonical
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-swift-frontend %s -emit-ir | FileCheck %s
|
||||
// RUN: %target-swift-frontend -primary-file %s -emit-ir | FileCheck %s
|
||||
|
||||
// REQUIRES: CPU=x86_64
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// RUN: rm -rf %t && mkdir %t
|
||||
// RUN: %build-irgen-test-overlays
|
||||
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize %s
|
||||
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize %s
|
||||
|
||||
// REQUIRES: objc_interop
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-swift-frontend -emit-ir %s > %t
|
||||
// RUN: %target-swift-frontend -primary-file %s -emit-ir > %t
|
||||
// RUN: FileCheck %s --check-prefix=CHECK-%target-object-format --check-prefix=CHECK < %t
|
||||
// RUN: FileCheck -check-prefix=NEGATIVE %s < %t
|
||||
|
||||
|
||||
@@ -150,6 +150,9 @@ static llvm::cl::opt<unsigned>
|
||||
ASTVerifierProcessId("ast-verifier-process-id", llvm::cl::Hidden,
|
||||
llvm::cl::init(1));
|
||||
|
||||
static llvm::cl::opt<bool>
|
||||
PerformWMO("wmo", llvm::cl::desc("Enable whole-module optimizations"));
|
||||
|
||||
static void runCommandLineSelectedPasses(SILModule *Module) {
|
||||
SILPassManager PM(Module);
|
||||
|
||||
@@ -253,8 +256,20 @@ int main(int argc, char **argv) {
|
||||
PrintingDiagnosticConsumer PrintDiags;
|
||||
CI.addDiagnosticConsumer(&PrintDiags);
|
||||
|
||||
if (!PerformWMO) {
|
||||
auto &FrontendOpts = Invocation.getFrontendOptions();
|
||||
if (!InputFilename.empty() && InputFilename != "-") {
|
||||
FrontendOpts.PrimaryInput = SelectedInput(
|
||||
FrontendOpts.InputFilenames.size());
|
||||
} else {
|
||||
FrontendOpts.PrimaryInput = SelectedInput(
|
||||
FrontendOpts.InputBuffers.size(), SelectedInput::InputKind::Buffer);
|
||||
}
|
||||
}
|
||||
|
||||
if (CI.setup(Invocation))
|
||||
return 1;
|
||||
|
||||
CI.performSema();
|
||||
|
||||
// If parsing produced an error, don't run any passes.
|
||||
|
||||
Reference in New Issue
Block a user