This is an archive of the discontinued LLVM Phabricator instance.

use StringMap in llvm-dwp when merging debug_str.dwo section
Needs RevisionPublic

Authored by zhuna8616 on Jul 3 2023, 6:16 AM.

Details

Diff Detail

Event Timeline

zhuna8616 created this revision.Jul 3 2023, 6:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 3 2023, 6:16 AM
zhuna8616 requested review of this revision.Jul 3 2023, 6:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 3 2023, 6:16 AM
dblaikie accepted this revision.Jul 3 2023, 8:58 AM

Looks good. Could you include some comparison numbers, if you have them, in the commit message? (What target did you test (clang is an easy one), time and memory usage would be good to know)

This revision is now accepted and ready to land.Jul 3 2023, 8:58 AM
dblaikie requested changes to this revision.Jul 3 2023, 8:59 AM

Oh, wait. This will increase memory usage by copying the strings into the string map which is is unfortunate... Any way to avoid that?

This revision now requires changes to proceed.Jul 3 2023, 8:59 AM
zhuna8616 updated this revision to Diff 537081.Jul 4 2023, 6:27 AM

correct StringRef in make_pair

My bad... I forgot to convert const char * to StringRef.

StringRef alone doesn't seem to do any copy. StringMap copies the key into the map. The old implementation uses const char * and has none of such problem. I can think of no other way to it if we persist using StringMap.

StringMap clones the strings. DenseMap<CachedHashStringRef, uint32_t> may be more efficient.

MaskRay requested changes to this revision.Jul 5 2023, 11:25 AM
This revision now requires changes to proceed.Jul 5 2023, 11:25 AM

My bad... I forgot to convert const char * to StringRef.

StringRef alone doesn't seem to do any copy. StringMap copies the key into the map. The old implementation uses const char * and has none of such problem. I can think of no other way to it if we persist using StringMap.

Yeah - maybe lld has something that can be generalized and avoids this issue. I think it also has multithreading in string merging too.

MTC added a subscriber: MTC.Jul 31 2023, 11:06 PM