This is an archive of the discontinued LLVM Phabricator instance.

Reset NextFnNum in MachineModuleInfo::initialize
ClosedPublic

Authored by dsanders on Apr 19 2021, 2:48 PM.

Details

Summary

In an env that reuses compiler instances for multiple compilations, this
omission results in non-deterministic assembly output (names of the
auto-generated labels) if the order or full set of Modules compiled
varies.

Diff Detail

Event Timeline

dsanders created this revision.Apr 19 2021, 2:48 PM
dsanders requested review of this revision.Apr 19 2021, 2:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 19 2021, 2:48 PM

Patch by Roman Tereshin (it seems arcanist loses that info for the review)

bogner accepted this revision.Apr 19 2021, 2:54 PM
bogner added a subscriber: bogner.

Probably better to switch all of these to C++11 style default member initializers and remove initialize() entirely. This is obviously correct either way though.

This revision is now accepted and ready to land.Apr 19 2021, 2:54 PM

Probably better to switch all of these to C++11 style default member initializers and remove initialize() entirely. This is obviously correct either way though.

Oh, the MMI gets reused by the pass - to do this you'd need to also fix finalize() to properly clear these members (and maybe rename it reset() or so instead of tying this to the pass structure so tightly)

It turns out someone already added C++11 default initializers but they're not used in this case. MachineModuleInfo could use some better commenting about its lifetime so I'll add that in a follow-up at the same time as renaming it

This revision was automatically updated to reflect the committed changes.