Skip to content

[BOLT] Evaluate and speedup discoverFileObjects #90661

Open
@aaupov

Description

@aaupov

Operations with symbols such as name lookup are expensive and some binaries have millions of symbols, so it makes sense to try to reduce the symbol-related overheads.

Measure how much the following cost and refactor/eliminate:

  1. Checks for symbol name being equal to __asan_init and __llvm_coverage_mapping for every single symbol:
    for (const ELFSymbolRef &Symbol : InputFile->symbols()) {
    Expected<StringRef> NameOrError = Symbol.getName();
    if (NameOrError && NameOrError->starts_with("__asan_init")) {
    BC->errs()
    << "BOLT-ERROR: input file was compiled or linked with sanitizer "
    "support. Cannot optimize.\n";
    exit(1);
    }
    if (NameOrError && NameOrError->starts_with("__llvm_coverage_mapping")) {
    BC->errs()
    << "BOLT-ERROR: input file was compiled or linked with coverage "
    "support. Cannot optimize.\n";
    exit(1);
    }
  2. FileName set for every local function symbol (with O(1M) for large binaries) while we can instead use file symbol lookup with O(log N_Syms) cost and FileSyms memory cost [BOLT][NFCI] Use FileSymbols for local symbol disambiguation #89088
  3. Merge iteration over two loops over symbols into one:
    for (const ELFSymbolRef &Symbol : InputFile->symbols()) {
    and
    for (const SymbolRef &Symbol : InputFile->symbols())

Metadata

Metadata

Assignees

No one assigned

    Labels

    BOLTgood first issuehttps://github.com/llvm/llvm-project/contributehelp wantedIndicates that a maintainer wants help. Not [good first issue].

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions