[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.

llvm-svn: 371744
This commit is contained in:
Fangrui Song 2019-09-12 16:46:19 +00:00
parent a6e944b173
commit 2ad25a4aee
1 changed files with 5 additions and 4 deletions

View 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) {