[lld] r371744 - [ELF] ICF: change a dyn_cast<InputSection> to cast

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 12 09:46:19 PDT 2019


Author: maskray
Date: Thu Sep 12 09:46:19 2019
New Revision: 371744

URL: http://llvm.org/viewvc/llvm-project?rev=371744&view=rev
Log:
[ELF] ICF: change a dyn_cast<InputSection> to cast

ICF is performed after EhInputSections and MergeInputSections were
eliminated from inputSections. Every element of inputSections is an
InputSection.

Modified:
    lld/trunk/ELF/ICF.cpp

Modified: lld/trunk/ELF/ICF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ICF.cpp?rev=371744&r1=371743&r2=371744&view=diff
==============================================================================
--- lld/trunk/ELF/ICF.cpp (original)
+++ lld/trunk/ELF/ICF.cpp Thu Sep 12 09:46:19 2019
@@ -446,10 +446,11 @@ static void print(const Twine &s) {
 // The main function of ICF.
 template <class ELFT> void ICF<ELFT>::run() {
   // Collect sections to merge.
-  for (InputSectionBase *sec : inputSections)
-    if (auto *s = dyn_cast<InputSection>(sec))
-      if (isEligible(s))
-        sections.push_back(s);
+  for (InputSectionBase *sec : inputSections) {
+    auto *s = cast<InputSection>(sec);
+    if (isEligible(s))
+      sections.push_back(s);
+  }
 
   // Initially, we use hash values to partition sections.
   parallelForEach(sections, [&](InputSection *s) {




More information about the llvm-commits mailing list