[ELF] Relocations: Avoid MIPS check for ELFCLASS64 with if constexpr. NFC After inlining, `scanSection` is significantly longer (more than 100+ instructions on x86-64 built with Clang) when `i` does not always increment by one (MIPS).
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp index 5527434..04db413 100644 --- a/lld/ELF/Relocations.cpp +++ b/lld/ELF/Relocations.cpp
@@ -1419,11 +1419,16 @@ uint32_t symIndex = rel.getSymbol(config->isMips64EL); Symbol &sym = sec->getFile<ELFT>()->getSymbol(symIndex); RelType type; - if (config->mipsN32Abi) { - type = getMipsN32RelType(i); - } else { + if constexpr (ELFT::Is64Bits) { type = rel.getType(config->isMips64EL); ++i; + } else { + if (config->mipsN32Abi) { + type = getMipsN32RelType(i); + } else { + type = rel.getType(config->isMips64EL); + ++i; + } } // Get an offset in an output section this relocation is applied to. uint64_t offset = getter.get(rel.r_offset);