Verify SIL modules at the beginning and at the end of the SIL optimization pipelines, if -sil-verify-all is provided

Till now, a SIL module would be only verified if an optimization has changed it. But if there were no changes, then no verification would happen and some SIL module format errors would stay unnoticed. This was happening in certain cases when reading a textual SIL module representation, which turned out to be broken, but SIL verifier wouldn't catch it.

Swift SVN r31863
This commit is contained in:
Roman Levenstein
2015-09-10 22:26:37 +00:00
parent 66e13af73e
commit 141b8f814d
13 changed files with 46 additions and 33 deletions

View File

@@ -150,9 +150,6 @@ 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);
@@ -256,20 +253,8 @@ 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.