Add an early return.

Total memory allocation when linking clang goes from 281.80MB to
270.96MB.

llvm-svn: 319930
This commit is contained in:
Rafael Espindola 2017-12-06 19:13:23 +00:00
parent e85b4df435
commit 0ab9d8b6ed
1 changed files with 2 additions and 0 deletions

View File

@ -184,6 +184,8 @@ static std::string getFilename(InputFile *File) {
}
bool LinkerScript::shouldKeep(InputSectionBase *S) {
if (KeptSections.empty())
return false;
std::string Filename = getFilename(S->File);
for (InputSectionDescription *ID : KeptSections)
if (ID->FilePat.match(Filename))