COFF: Enable ICF by default.

MSVC linker enables ICF as long as /opt:ref is eanbled, so do we.

llvm-svn: 247817
This commit is contained in:
Rui Ueyama 2015-09-16 16:41:38 +00:00
parent c04d5dbf20
commit b02a320f5e
5 changed files with 5 additions and 6 deletions

View File

@ -66,6 +66,7 @@ struct Configuration {
bool NoEntry = false; bool NoEntry = false;
std::string OutputFile; std::string OutputFile;
bool DoGC = true; bool DoGC = true;
bool DoICF = true;
bool Relocatable = true; bool Relocatable = true;
bool Force = false; bool Force = false;
bool Debug = false; bool Debug = false;
@ -88,9 +89,6 @@ struct Configuration {
DefinedRelative *SEHTable = nullptr; DefinedRelative *SEHTable = nullptr;
DefinedAbsolute *SEHCount = nullptr; DefinedAbsolute *SEHCount = nullptr;
// True if /opt:icf is specified.
bool DoICF = false;
// Used for /opt:lldlto=N // Used for /opt:lldlto=N
unsigned LTOOptLevel = 2; unsigned LTOOptLevel = 2;

View File

@ -367,6 +367,7 @@ void LinkerDriver::link(llvm::ArrayRef<const char *> ArgsArr) {
std::string S = StringRef(Arg->getValue()).lower(); std::string S = StringRef(Arg->getValue()).lower();
if (S == "noref") { if (S == "noref") {
Config->DoGC = false; Config->DoGC = false;
Config->DoICF = false;
continue; continue;
} }
if (S == "icf" || StringRef(S).startswith("icf=")) { if (S == "icf" || StringRef(S).startswith("icf=")) {

View File

@ -1,6 +1,6 @@
# RUN: yaml2obj < %s > %t.obj # RUN: yaml2obj < %s > %t.obj
# RUN: lld-link /entry:foo /out:%t.exe /subsystem:console /include:bar \ # RUN: lld-link /entry:foo /out:%t.exe /subsystem:console /include:bar \
# RUN: /opt:icf /verbose %t.obj > %t.log 2>&1 # RUN: /verbose %t.obj > %t.log 2>&1
# RUN: FileCheck %s < %t.log # RUN: FileCheck %s < %t.log
# CHECK: Selected foo # CHECK: Selected foo

View File

@ -1,6 +1,6 @@
# RUN: yaml2obj < %s > %t.obj # RUN: yaml2obj < %s > %t.obj
# RUN: lld-link /entry:foo /out:%t.exe /subsystem:console /include:bar \ # RUN: lld-link /entry:foo /out:%t.exe /subsystem:console /include:bar \
# RUN: /opt:icf /verbose %t.obj > %t.log 2>&1 # RUN: /verbose %t.obj > %t.log 2>&1
# RUN: FileCheck %s < %t.log # RUN: FileCheck %s < %t.log
# CHECK: Selected foo # CHECK: Selected foo

View File

@ -1,6 +1,6 @@
# RUN: yaml2obj < %s > %t.obj # RUN: yaml2obj < %s > %t.obj
# RUN: lld-link /entry:foo /out:%t.exe /subsystem:console /include:bar \ # RUN: lld-link /entry:foo /out:%t.exe /subsystem:console /include:bar \
# RUN: /opt:icf /verbose %t.obj > %t.log 2>&1 # RUN: /verbose %t.obj > %t.log 2>&1
# RUN: FileCheck %s < %t.log # RUN: FileCheck %s < %t.log
# CHECK: Selected foo # CHECK: Selected foo