From 2ad25a4aeeae6e070c9cb56cc15e82ba6e2231af Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Thu, 12 Sep 2019 16:46:19 +0000 Subject: [PATCH] [ELF] ICF: change a dyn_cast to cast 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 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lld/ELF/ICF.cpp b/lld/ELF/ICF.cpp index 8664811..c50bbc6 100644 --- a/lld/ELF/ICF.cpp +++ b/lld/ELF/ICF.cpp @@ -446,10 +446,11 @@ static void print(const Twine &s) { // The main function of ICF. template void ICF::run() { // Collect sections to merge. - for (InputSectionBase *sec : inputSections) - if (auto *s = dyn_cast(sec)) - if (isEligible(s)) - sections.push_back(s); + for (InputSectionBase *sec : inputSections) { + auto *s = cast(sec); + if (isEligible(s)) + sections.push_back(s); + } // Initially, we use hash values to partition sections. parallelForEach(sections, [&](InputSection *s) { -- 2.7.4