This is an archive of the discontinued LLVM Phabricator instance.

ManagedStatic: remove many straightforward uses in llvm
ClosedPublic

Authored by nhaehnle on Jul 5 2022, 2:15 AM.

Details

Summary

Bulk remove many of the more trivial uses of ManagedStatic in the llvm
directory, either by defining a new getter function or, in many cases,
moving the static variable directly into the only function that uses it.

Diff Detail

Event Timeline

nhaehnle created this revision.Jul 5 2022, 2:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 5 2022, 2:15 AM
nhaehnle requested review of this revision.Jul 5 2022, 2:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 5 2022, 2:15 AM
efriedma added inline comments.Jul 5 2022, 12:00 PM
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
10765

This Mutex usage is dubious; at best this leaks memory; at worst, it's a miscompile waiting to happen.

Granted, that's true even without this patch...

efriedma added inline comments.Jul 5 2022, 12:03 PM
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
10765

Oh, wait, nevermind... it's computing a unique address for the value, but it only cares about the pointer bits. Which I guess is dubious due to pointer provenance, but not likely to cause a practical issue.

lattner accepted this revision.Jul 5 2022, 12:26 PM

Cool, I didn't scrutinize every use, but the concept makes a ton of sense to me. +1 for cleaning this up and simplifying things, thanks!

This revision is now accepted and ready to land.Jul 5 2022, 12:26 PM
This revision was landed with ongoing or failed builds.Jul 10 2022, 12:15 AM
This revision was automatically updated to reflect the committed changes.