This is an archive of the discontinued LLVM Phabricator instance.

[ASan] Make GlobalsMD member a const reference
ClosedPublic

Authored by leonardchan on Oct 1 2019, 11:42 AM.

Details

Summary
PR42924 points out that copying the GlobalsMetadata type during
construction of AddressSanitizer can result in exteremely lengthened
build times for translation units that have many globals. This can be addressed
by just making the GlobalsMD member in AddressSanitizer a reference to
avoid the copy. The GlobalsMetadata type is already passed to the
constructor as a reference anyway.

Diff Detail

Event Timeline

leonardchan created this revision.Oct 1 2019, 11:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 1 2019, 11:42 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
vitalybuka accepted this revision.Oct 1 2019, 1:23 PM
This revision is now accepted and ready to land.Oct 1 2019, 1:23 PM
vitalybuka added inline comments.Oct 1 2019, 1:28 PM
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
695

please add const into constructor
ModuleAddressSanitizer(Module &M, const GlobalsMetadata &GlobalsMD,

maybe also pointer, so you can't pass temp object
ModuleAddressSanitizer(Module &M, const GlobalsMetadata *GlobalsMD,

This revision was automatically updated to reflect the committed changes.
leonardchan marked 2 inline comments as done.Oct 1 2019, 1:47 PM
leonardchan added inline comments.
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
695

Woops. Sorry, I committed after I got the LGTM but didn't see your comments until later. I committed r373391 which addresses these comments.