[PATCH] D33515: Fix the ManagedStatic list ordering when using DynamicLibrary::addPermanentLibrary.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 25 18:11:26 PDT 2017
efriedma added a comment.
In https://reviews.llvm.org/D33515#764769, @marsupial wrote:
> {
> llvm_shutdown_obj Shutdown;
> // Do some stuff (Polly passes available via RegisterStandardPasses)
> }
> // All passes added via RegisterStandardPasses have now been removed
> {
> llvm_shutdown_obj Shutdown;
> // Do some other stuff (Polly passes no longer available)
> }
>
Yes, this doesn't work at the moment.
The tricky part here is that we support both building both polly as a plugin and statically linking polly as part of the same build... but we could make it work, I guess, if people actually use llvm_shutdown_obj like this. (We could split the RegisterStandardPasses off into a separate object file, and only link it in when we're building the plugin.)
================
Comment at: lib/Transforms/IPO/PassManagerBuilder.cpp:201
PassManagerBuilder::ExtensionFn Fn) {
+ sys::DynamicLibrary::init();
GlobalExtensions->push_back(std::make_pair(Ty, std::move(Fn)));
----------------
This change is assuming addGlobalExtension is special, i.e. destructors for other ManagedStatics won't run into this issue. That seems a little fragile... would it make sense to do this in ManagedStatic itself instead (i.e. ensure HandleSet is always constructed first/destroyed last)?
https://reviews.llvm.org/D33515
More information about the llvm-commits
mailing list