[lld] r247817 - COFF: Enable ICF by default.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 09:41:39 PDT 2015


Author: ruiu
Date: Wed Sep 16 11:41:38 2015
New Revision: 247817

URL: http://llvm.org/viewvc/llvm-project?rev=247817&view=rev
Log:
COFF: Enable ICF by default.

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

Modified:
    lld/trunk/COFF/Config.h
    lld/trunk/COFF/Driver.cpp
    lld/trunk/test/COFF/icf-circular.test
    lld/trunk/test/COFF/icf-circular2.test
    lld/trunk/test/COFF/icf-simple.test

Modified: lld/trunk/COFF/Config.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Config.h?rev=247817&r1=247816&r2=247817&view=diff
==============================================================================
--- lld/trunk/COFF/Config.h (original)
+++ lld/trunk/COFF/Config.h Wed Sep 16 11:41:38 2015
@@ -66,6 +66,7 @@ struct Configuration {
   bool NoEntry = false;
   std::string OutputFile;
   bool DoGC = true;
+  bool DoICF = true;
   bool Relocatable = true;
   bool Force = false;
   bool Debug = false;
@@ -88,9 +89,6 @@ struct Configuration {
   DefinedRelative *SEHTable = nullptr;
   DefinedAbsolute *SEHCount = nullptr;
 
-  // True if /opt:icf is specified.
-  bool DoICF = false;
-
   // Used for /opt:lldlto=N
   unsigned LTOOptLevel = 2;
 

Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=247817&r1=247816&r2=247817&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Wed Sep 16 11:41:38 2015
@@ -367,6 +367,7 @@ void LinkerDriver::link(llvm::ArrayRef<c
     std::string S = StringRef(Arg->getValue()).lower();
     if (S == "noref") {
       Config->DoGC = false;
+      Config->DoICF = false;
       continue;
     }
     if (S == "icf" || StringRef(S).startswith("icf=")) {

Modified: lld/trunk/test/COFF/icf-circular.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/icf-circular.test?rev=247817&r1=247816&r2=247817&view=diff
==============================================================================
--- lld/trunk/test/COFF/icf-circular.test (original)
+++ lld/trunk/test/COFF/icf-circular.test Wed Sep 16 11:41:38 2015
@@ -1,6 +1,6 @@
 # RUN: yaml2obj < %s > %t.obj
 # 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
 
 # CHECK: Selected foo

Modified: lld/trunk/test/COFF/icf-circular2.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/icf-circular2.test?rev=247817&r1=247816&r2=247817&view=diff
==============================================================================
--- lld/trunk/test/COFF/icf-circular2.test (original)
+++ lld/trunk/test/COFF/icf-circular2.test Wed Sep 16 11:41:38 2015
@@ -1,6 +1,6 @@
 # RUN: yaml2obj < %s > %t.obj
 # 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
 
 # CHECK: Selected foo

Modified: lld/trunk/test/COFF/icf-simple.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/icf-simple.test?rev=247817&r1=247816&r2=247817&view=diff
==============================================================================
--- lld/trunk/test/COFF/icf-simple.test (original)
+++ lld/trunk/test/COFF/icf-simple.test Wed Sep 16 11:41:38 2015
@@ -1,6 +1,6 @@
 # RUN: yaml2obj < %s > %t.obj
 # 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
 
 # CHECK: Selected foo




More information about the llvm-commits mailing list