This is an archive of the discontinued LLVM Phabricator instance.

[Timer][Statistics] Make global constructor ordering more robust
ClosedPublic

Authored by nhaehnle on Aug 3 2022, 2:07 AM.

Details

Summary

It was observed in D129117 that the subtle dependency between statistic
and timer code is not entirely robust: the global destructor
~StatisticInfo indirectly calls CreateInfoOutputFile, which requires
the LibSupportInfoOutputFilename to not have been destructed.

By constructing LibSupportInfoOutputFilename before the StatisticInfo
object, the order of destruction is guaranteed.

Diff Detail

Event Timeline

nhaehnle created this revision.Aug 3 2022, 2:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2022, 2:07 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
nhaehnle requested review of this revision.Aug 3 2022, 2:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2022, 2:07 AM
This revision is now accepted and ready to land.Aug 3 2022, 10:13 AM
MaskRay accepted this revision.Aug 4 2022, 1:19 AM
MaskRay added a subscriber: MaskRay.
MaskRay added inline comments.
llvm/lib/Support/Timer.cpp
502–503

You can use constructForStatistics while renaming.