This is an archive of the discontinued LLVM Phabricator instance.

Speed up gdb index creation
ClosedPublic

Authored by rafael on Jul 13 2017, 2:32 PM.

Details

Reviewers
dblaikie
ruiu
Summary

This depends on https://reviews.llvm.org/D35373

With that in place we can use lld's own infrastructure for the low level detail of dwarf parsing.

With this we don't decompress sections twice, we don't scan all realocations and even with this simplistic implementation linking clang with gdb index goes from 34.09 seconds to 20.80 seconds.

Diff Detail

Event Timeline

rafael created this revision.Jul 13 2017, 2:32 PM
ruiu added inline comments.Jul 13 2017, 2:42 PM
ELF/GdbIndex.cpp
56

auto -> LLDDWARFSection

60

Is this safe?

65

auto -> StringRef

69

Is returning a nullptr safe?

I think writing without StringSwitch is more straightforward:

if (Sec->Name == ".debug_abbrev")
  AbbrevSection = toStringRef...;
else if (Sec->Name == ".debug_gnu_pubnames")
  GnuPubNameSection = toStringRef...;
else if ...
74

I'd write a function comment.

ELF/GdbIndex.h
22–26

Are these classes designed to be inherited? I prefer delegation over inheritance and am wondering if this is a good approach.

41

explicit?

Address review comments.

ruiu accepted this revision.Jul 13 2017, 4:34 PM

LGTM

ELF/GdbIndex.cpp
56–64

This may look a bit dumb, but I think I prefer this style over StringSwitch:

if (Sec->Name == ".debug_info") {
  InfoSection->Data = toStringRef(Sec->Data);
  InfoSection->Sec = Sec;
} else if (Sec->Name == ".debug_ranges") {
  RangeSection->Data = toStringRef(Sec->Data);
  RangeSection->Sec = Sec;
} else if ...
ELF/InputFiles.cpp
60–61

DO sounds like a verb. How about DOjb or just Obj?

This revision is now accepted and ready to land.Jul 13 2017, 4:34 PM
grimar added a subscriber: grimar.Jul 14 2017, 1:11 AM

Looks great !

Change variable name and rebase.

I have kept the StringSwitch since it looks odd to duplicate a multiline if body.

ruiu accepted this revision.Jul 14 2017, 12:34 PM

Is that that odd? StringSwitch seems a bit too clever to my taste, but I'm fine in either way. LGTM

thakis closed this revision.Jul 21 2017, 8:59 AM
thakis added a subscriber: thakis.

r308544