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

@@ -18,6 +18,7 @@
#include "swift/Serialization/SerializedSILLoader.h"
#include "swift/SIL/SILValue.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Support/Debug.h"
@@ -91,10 +92,11 @@ class SILModule::SerializationCallback : public SerializedSILLoader::Callback {
}
};
SILModule::SILModule(Module *SwiftModule, const DeclContext *associatedDC)
SILModule::SILModule(Module *SwiftModule, const DeclContext *associatedDC,
bool wholeModule)
: TheSwiftModule(SwiftModule), AssociatedDeclContext(associatedDC),
Stage(SILStage::Raw), Callback(new SILModule::SerializationCallback()),
Types(*this) {
wholeModule(wholeModule), Types(*this) {
TypeListUniquing = new SILTypeListUniquingType();
}
@@ -663,6 +665,12 @@ private:
} // end anonymous namespace.
SILFunction *SILModule::lookUpFunction(SILDeclRef fnRef) {
llvm::SmallString<32> name;
fnRef.mangle(name);
return lookUpFunction(name);
}
bool SILModule::linkFunction(SILFunction *Fun, SILModule::LinkingMode Mode) {
return SILLinkerVisitor(*this, getSILLoader(), Mode,
ExternalSource).processFunction(Fun);