Enable dead function removal for internal function in whole-module compilation.

This is controlled by a new isWholeModule() attribute in SILModule.

It gives about 9% code size reduction on the benchmark executables.
For test-suite reasons it is currently not done for the stdlib.



Swift SVN r22491
This commit is contained in:
Erik Eckstein
2014-10-03 14:14:23 +00:00
parent 60dcb9a435
commit 43f68b6974
19 changed files with 147 additions and 50 deletions

View File

@@ -180,7 +180,14 @@ static bool performCompile(CompilerInstance &Instance,
if (PrimarySourceFile)
SM = performSILGeneration(*PrimarySourceFile, None, opts.SILSerializeAll);
else
SM = performSILGeneration(Instance.getMainModule(), opts.SILSerializeAll);
SM = performSILGeneration(Instance.getMainModule(), opts.SILSerializeAll,
// Only do whole-module compilation if these options are not set.
// This is to keep the test suite happy (many tests use internal
// functions).
// TODO: add a separate option to explicitly disable whole-
// module compilation (to be used in the testsuite).
Invocation.getLangOptions().EnableAccessControl &&
Invocation.getLangOptions().EnableObjCAttrRequiresFoundation);
}
// We've been told to emit SIL after SILGen, so write it now.