[ELF] ICF: change a dyn_cast<InputSection> to cast
authorFangrui Song <maskray@google.com>
Thu, 12 Sep 2019 16:46:19 +0000 (16:46 +0000)
committerFangrui Song <maskray@google.com>
Thu, 12 Sep 2019 16:46:19 +0000 (16:46 +0000)
ICF is performed after EhInputSections and MergeInputSections were
eliminated from inputSections. Every element of inputSections is an
InputSection.

llvm-svn: 371744

lld/ELF/ICF.cpp

index 8664811..c50bbc6 100644 (file)
@@ -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) {