[lld] r247854 - COFF: Fix bug that /opt:noicf was ignored.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 14:30:56 PDT 2015


Author: ruiu
Date: Wed Sep 16 16:30:55 2015
New Revision: 247854

URL: http://llvm.org/viewvc/llvm-project?rev=247854&view=rev
Log:
COFF: Fix bug that /opt:noicf was ignored.

Modified:
    lld/trunk/COFF/Driver.cpp
    lld/trunk/test/COFF/icf-simple.test

Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=247854&r1=247853&r2=247854&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Wed Sep 16 16:30:55 2015
@@ -374,6 +374,10 @@ void LinkerDriver::link(llvm::ArrayRef<c
       Config->DoICF = true;
       continue;
     }
+    if (S == "noicf") {
+      Config->DoICF = false;
+      continue;
+    }
     if (StringRef(S).startswith("lldlto=")) {
       StringRef OptLevel = StringRef(S).substr(7);
       if (OptLevel.getAsInteger(10, Config->LTOOptLevel) ||
@@ -387,7 +391,7 @@ void LinkerDriver::link(llvm::ArrayRef<c
         error("/opt:lldltojobs: invalid job count: " + Jobs);
       continue;
     }
-    if (S != "ref" && S != "noicf" && S != "lbr" && S != "nolbr")
+    if (S != "ref" && S != "lbr" && S != "nolbr")
       error(Twine("/opt: unknown option: ") + S);
   }
 

Modified: lld/trunk/test/COFF/icf-simple.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/icf-simple.test?rev=247854&r1=247853&r2=247854&view=diff
==============================================================================
--- lld/trunk/test/COFF/icf-simple.test (original)
+++ lld/trunk/test/COFF/icf-simple.test Wed Sep 16 16:30:55 2015
@@ -1,10 +1,17 @@
 # RUN: yaml2obj < %s > %t.obj
 # RUN: lld-link /entry:foo /out:%t.exe /subsystem:console /include:bar \
 # RUN:   /verbose %t.obj > %t.log 2>&1
-# RUN: FileCheck %s < %t.log
+# RUN: FileCheck -check-prefix=ICF %s < %t.log
 
-# CHECK: Selected foo
-# CHECK:   Removed bar
+# ICF: Selected foo
+# ICF:   Removed bar
+
+# RUN: lld-link /entry:foo /out:%t.exe /subsystem:console /include:bar \
+# RUN:   /verbose /opt:noicf %t.obj > %t.log 2>&1
+# RUN: FileCheck -check-prefix=NOICF %s < %t.log
+
+# NOICF-NOT: Removed foo
+# NOICF-NOT: Removed bar
 
 ---
 header:




More information about the llvm-commits mailing list