[lld] r324755 - Do not print out removed ICF sections for -verbose.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 9 09:55:09 PST 2018


Author: ruiu
Date: Fri Feb  9 09:55:09 2018
New Revision: 324755

URL: http://llvm.org/viewvc/llvm-project?rev=324755&view=rev
Log:
Do not print out removed ICF sections for -verbose.

GNU gold doesn't print out ICF sections for -verbose. It only shows
them for -print-icf-sections. We printed out them for -verbose because
we didn't have -print-icf-sections. Now that we have the option, there's
no reason to print out for -verbose.

Differential Revision: https://reviews.llvm.org/D43100

Modified:
    lld/trunk/ELF/ICF.cpp
    lld/trunk/test/ELF/icf-absolute.s
    lld/trunk/test/ELF/icf-comdat.s
    lld/trunk/test/ELF/icf-i386.s
    lld/trunk/test/ELF/icf-merge-sec.s
    lld/trunk/test/ELF/icf-merge.s
    lld/trunk/test/ELF/icf1.s
    lld/trunk/test/ELF/icf2.s
    lld/trunk/test/ELF/icf7.s
    lld/trunk/test/ELF/icf9.s

Modified: lld/trunk/ELF/ICF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ICF.cpp?rev=324755&r1=324754&r2=324755&view=diff
==============================================================================
--- lld/trunk/ELF/ICF.cpp (original)
+++ lld/trunk/ELF/ICF.cpp Fri Feb  9 09:55:09 2018
@@ -425,17 +425,11 @@ template <class ELFT> void ICF<ELFT>::ru
   log("ICF needed " + Twine(Cnt) + " iterations");
 
   auto Print = [&](const Twine &Prefix, size_t I) {
-    if (!Config->PrintIcfSections && !errorHandler().Verbose)
+    if (!Config->PrintIcfSections)
       return;
-    std::string Filename =
-        Sections[I]->File ? Sections[I]->File->getName() : "<internal>";
-    std::string S = (Prefix + " section '" + Sections[I]->Name +
-                     "' from file '" + Filename + "'")
-                        .str();
-    if (Config->PrintIcfSections)
-      message(S);
-    else
-      log(S);
+    InputSection *S = Sections[I];
+    std::string File = S->File ? S->File->getName() : "<internal>";
+    message(Prefix + " section '" + S->Name + "' from file '" + File + "'");
   };
 
   // Merge sections by the equivalence class.

Modified: lld/trunk/test/ELF/icf-absolute.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/icf-absolute.s?rev=324755&r1=324754&r2=324755&view=diff
==============================================================================
--- lld/trunk/test/ELF/icf-absolute.s (original)
+++ lld/trunk/test/ELF/icf-absolute.s Fri Feb  9 09:55:09 2018
@@ -2,7 +2,7 @@
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/icf-absolute.s -o %t2
-# RUN: ld.lld %t %t2 -o %t3 --icf=all --verbose 2>&1 | FileCheck %s
+# RUN: ld.lld %t %t2 -o %t3 --icf=all --print-icf-sections | FileCheck %s
 
 # CHECK: selected section '.text.f1' from file
 # CHECK:   removing identical section '.text.f2' from file

Modified: lld/trunk/test/ELF/icf-comdat.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/icf-comdat.s?rev=324755&r1=324754&r2=324755&view=diff
==============================================================================
--- lld/trunk/test/ELF/icf-comdat.s (original)
+++ lld/trunk/test/ELF/icf-comdat.s Fri Feb  9 09:55:09 2018
@@ -1,7 +1,7 @@
 # REQUIRES: x86
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
-# RUN: ld.lld %t -o %t2 --icf=all --verbose 2>&1 | FileCheck %s
+# RUN: ld.lld %t -o %t2 --icf=all --print-icf-sections | FileCheck %s
 
 # CHECK: selected section '.text.f1' from file [[T:'.*']]
 # CHECK:   removing identical section '.text.f2' from file [[T]]

Modified: lld/trunk/test/ELF/icf-i386.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/icf-i386.s?rev=324755&r1=324754&r2=324755&view=diff
==============================================================================
--- lld/trunk/test/ELF/icf-i386.s (original)
+++ lld/trunk/test/ELF/icf-i386.s Fri Feb  9 09:55:09 2018
@@ -2,7 +2,7 @@
 # This test is to make sure that we can handle implicit addends properly.
 
 # RUN: llvm-mc -filetype=obj -triple=i386-unknown-linux %s -o %t
-# RUN: ld.lld %t -o %t2 --icf=all --verbose 2>&1 | FileCheck %s
+# RUN: ld.lld %t -o %t2 --icf=all --print-icf-sections 2>&1 | FileCheck %s
 
 # CHECK:     selected section '.text.f1' from file [[T:'.*']]
 # CHECK:       removing identical section '.text.f2' from file [[T]]

Modified: lld/trunk/test/ELF/icf-merge-sec.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/icf-merge-sec.s?rev=324755&r1=324754&r2=324755&view=diff
==============================================================================
--- lld/trunk/test/ELF/icf-merge-sec.s (original)
+++ lld/trunk/test/ELF/icf-merge-sec.s Fri Feb  9 09:55:09 2018
@@ -2,7 +2,7 @@
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/icf-merge-sec.s -o %t2
-# RUN: ld.lld %t %t2 -o %t3 --icf=all --verbose 2>&1 | FileCheck %s
+# RUN: ld.lld %t %t2 -o %t3 --icf=all --print-icf-sections | FileCheck %s
 
 # CHECK: selected section '.text.f1' from file
 # CHECK:   removing identical section '.text.f2' from file

Modified: lld/trunk/test/ELF/icf-merge.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/icf-merge.s?rev=324755&r1=324754&r2=324755&view=diff
==============================================================================
--- lld/trunk/test/ELF/icf-merge.s (original)
+++ lld/trunk/test/ELF/icf-merge.s Fri Feb  9 09:55:09 2018
@@ -2,13 +2,13 @@
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/icf-merge.s -o %t1
-# RUN: ld.lld %t %t1 -o %t1.out --icf=all --verbose 2>&1 | FileCheck %s
+# RUN: ld.lld %t %t1 -o %t1.out --icf=all --print-icf-sections | FileCheck %s
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/icf-merge2.s -o %t2
-# RUN: ld.lld %t %t2 -o %t3.out --icf=all --verbose 2>&1 | FileCheck --check-prefix=NOMERGE %s
+# RUN: ld.lld %t %t2 -o %t3.out --icf=all --print-icf-sections | FileCheck --check-prefix=NOMERGE %s
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/icf-merge3.s -o %t3
-# RUN: ld.lld %t %t3 -o %t3.out --icf=all --verbose 2>&1 | FileCheck --check-prefix=NOMERGE %s
+# RUN: ld.lld %t %t3 -o %t3.out --icf=all --print-icf-sections | FileCheck --check-prefix=NOMERGE %s
 
 # CHECK: selected section '.text.f1' from file
 # CHECK:   removing identical section '.text.f2' from file

Modified: lld/trunk/test/ELF/icf1.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/icf1.s?rev=324755&r1=324754&r2=324755&view=diff
==============================================================================
--- lld/trunk/test/ELF/icf1.s (original)
+++ lld/trunk/test/ELF/icf1.s Fri Feb  9 09:55:09 2018
@@ -1,7 +1,7 @@
 # REQUIRES: x86
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
-# RUN: ld.lld %t -o %t2 --icf=all --verbose 2>&1 | FileCheck %s
+# RUN: ld.lld %t -o %t2 --icf=all --print-icf-sections | FileCheck %s
 
 # CHECK: selected section '.text.f1' from file [[T:'.*']]
 # CHECK:   removing identical section '.text.f2' from file [[T]]

Modified: lld/trunk/test/ELF/icf2.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/icf2.s?rev=324755&r1=324754&r2=324755&view=diff
==============================================================================
--- lld/trunk/test/ELF/icf2.s (original)
+++ lld/trunk/test/ELF/icf2.s Fri Feb  9 09:55:09 2018
@@ -2,7 +2,7 @@
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/icf2.s -o %t2
-# RUN: ld.lld %t1 %t2 -o %t --icf=all --verbose 2>&1 | FileCheck %s
+# RUN: ld.lld %t1 %t2 -o %t --icf=all --print-icf-sections 2>&1 | FileCheck %s
 
 # CHECK: selected section '.text.f1' from file
 # CHECK:   removing identical section '.text.f2' from file

Modified: lld/trunk/test/ELF/icf7.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/icf7.s?rev=324755&r1=324754&r2=324755&view=diff
==============================================================================
--- lld/trunk/test/ELF/icf7.s (original)
+++ lld/trunk/test/ELF/icf7.s Fri Feb  9 09:55:09 2018
@@ -1,7 +1,7 @@
 # REQUIRES: x86
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
-# RUN: ld.lld %t -o %t2 --icf=all --verbose 2>&1 | FileCheck %s
+# RUN: ld.lld %t -o %t2 --icf=all --print-icf-sections | FileCheck %s
 # RUN: llvm-objdump -t %t2 | FileCheck -check-prefix=ALIGN %s
 
 # CHECK: selected section '.text.f1' from file [[T:'.*']]

Modified: lld/trunk/test/ELF/icf9.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/icf9.s?rev=324755&r1=324754&r2=324755&view=diff
==============================================================================
--- lld/trunk/test/ELF/icf9.s (original)
+++ lld/trunk/test/ELF/icf9.s Fri Feb  9 09:55:09 2018
@@ -2,7 +2,7 @@
 
 ### Make sure that we do not merge data.
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
-# RUN: ld.lld %t -o %t2 --icf=all --verbose 2>&1 | FileCheck %s
+# RUN: ld.lld %t -o %t2 --icf=all --verbose --print-icf-sections 2>&1 | FileCheck %s
 # RUN: llvm-readelf -S -W %t2 | FileCheck --check-prefix=SEC %s
 
 # SEC:  .rodata      PROGBITS  0000000000200120 000120 000002 00 A 0 0 1
@@ -11,7 +11,8 @@
 # CHECK-NOT: selected section '.rodata.d2'
 
 # We do merge rodata if passed --icf-data
-# RUN: ld.lld %t -o %t2 --icf=all --verbose --ignore-data-address-equality 2>&1 | FileCheck --check-prefix=DATA %s
+# RUN: ld.lld %t -o %t2 --icf=all --print-icf-sections --ignore-data-address-equality | \
+# RUN:   FileCheck --check-prefix=DATA %s
 # RUN: llvm-readelf -S -W %t2 | FileCheck --check-prefix=DATA-SEC %s
 
 # DATA: selected section '.rodata.d1' from file [[T:'.*']]




More information about the llvm-commits mailing list