This is an archive of the discontinued LLVM Phabricator instance.

[dsymutil][DWARFLinker][NFC] make AddressManager not depending on the order of checks for relocations.
ClosedPublic

Authored by avl on Dec 11 2020, 4:58 AM.

Details

Summary

Current dsymutil implementation of hasLiveMemoryLocation()/hasLiveAddressRange()
and applyValidRelocs() assume that calls should be done in certain order
(from first Dies to last). Multi-thread implementation might call these methods
in other order(it might process compilation units in order other than they are physically
located), so we remove restriction that searching for relocations should be done
in ascending order. This change does not introduce noticable performance degradation.
The testing results for clang binary:

golden-dsymutil/dsymutil 23787992
clang MD5: 5efa8fd9355ebf81b65f24db5375caa2
elapsed time=91sec

build-Release/bin/dsymutil 23855616
clang MD5: 5efa8fd9355ebf81b65f24db5375caa2
elapsed time=91sec

Diff Detail

Event Timeline

avl requested review of this revision.Dec 11 2020, 4:58 AM
avl created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptDec 11 2020, 4:58 AM
JDevlieghere added inline comments.Jan 11 2021, 10:20 AM
llvm/tools/dsymutil/DwarfLinkerForBinary.h
93

Can we return a list of relocations as an alternative to using a callback?

avl added inline comments.Jan 12 2021, 2:54 AM
llvm/tools/dsymutil/DwarfLinkerForBinary.h
93

I like that callback approach since it allows not to move/copy/resize/fill containers. But if you think it would be better to return list of found relocations then I would change it accordingly.

JDevlieghere added inline comments.Jan 14 2021, 10:05 AM
llvm/tools/dsymutil/DwarfLinkerForBinary.h
93

Personally I find callbacks always make it harder to reason about things. If there's not measurable performance overhead I'd prefer returning a list, but otherwise I'm find with a callback.

avl added inline comments.Jan 15 2021, 12:13 PM
llvm/tools/dsymutil/DwarfLinkerForBinary.h
93

In this concrete case there is no performance difference. So I changed to the container.

avl updated this revision to Diff 317046.Jan 15 2021, 12:15 PM

rebased. changed enumerator to the container.

JDevlieghere accepted this revision.Jan 29 2021, 12:16 PM

LGTM

llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
309

Newline

This revision is now accepted and ready to land.Jan 29 2021, 12:16 PM