This is an archive of the discontinued LLVM Phabricator instance.

[llvm-profgen] Refactor the code of getHashCode
ClosedPublic

Authored by wlei on Nov 2 2021, 2:44 PM.

Details

Summary

Refactor to generate hash code lazily. Tested on clang self build, no observable generating time regression.

Diff Detail

Event Timeline

wlei created this revision.Nov 2 2021, 2:44 PM
wlei requested review of this revision.Nov 2 2021, 2:44 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 2 2021, 2:44 PM
wlei edited the summary of this revision. (Show Details)Nov 2 2021, 2:55 PM
wlei added reviewers: hoy, wenlei.
wenlei added inline comments.Nov 2 2021, 4:04 PM
llvm/tools/llvm-profgen/PerfReader.h
350

This will compute hash code every time when we access it, can we do it only once? i.e. keep HashCode. same for the probe version.

if (!HashCode)
  HashCode = hash_value(SampleContextFrames(Context));
  
return HashCode;
wlei updated this revision to Diff 384273.Nov 2 2021, 4:31 PM

addressing Wenlei's feedback

hoy accepted this revision.Nov 2 2021, 4:44 PM

lgtm, thanks.

This revision is now accepted and ready to land.Nov 2 2021, 4:44 PM
wenlei accepted this revision.Nov 2 2021, 5:52 PM
This revision was automatically updated to reflect the committed changes.