nhaehnle updated this revision to Diff 447708.
nhaehnle added a comment.
Rebase
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129131/new/
https://reviews.llvm.org/D129131
Files:
bolt/tools/driver/llvm-bolt.cpp
bolt/tools/merge-fdata/merge-fdata.cpp
clang/include/clang/Frontend/CompilerInstance.h
clang/tools/clang-repl/ClangRepl.cpp
clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
clang/unittests/Interpreter/InterpreterTest.cpp
clang/utils/TableGen/TableGen.cpp
libclc/utils/prepare-builtins.cpp
lldb/tools/driver/Driver.cpp
lldb/tools/lldb-test/lldb-test.cpp
lldb/unittests/Utility/LogTest.cpp
lldb/utils/TableGen/LLDBTableGen.cpp
llvm/examples/BrainF/BrainFDriver.cpp
llvm/examples/HowToUseJIT/HowToUseJIT.cpp
llvm/include/llvm/PassRegistry.h
llvm/include/llvm/Support/DynamicLibrary.h
llvm/include/llvm/Support/InitLLVM.h
llvm/lib/IR/Pass.cpp
llvm/lib/Support/InitLLVM.cpp
llvm/lib/Support/Unix/DynamicLibrary.inc
llvm/lib/Support/Unix/Signals.inc
llvm/lib/Support/Windows/DynamicLibrary.inc
llvm/tools/gold/gold-plugin.cpp
llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
llvm/unittests/ExecutionEngine/ExecutionEngineTest.cpp
llvm/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
llvm/utils/KillTheDoctor/KillTheDoctor.cpp
mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp
polly/lib/External/isl/interface/extract_interface.cc
Index: polly/lib/External/isl/interface/extract_interface.cc
===================================================================
--- polly/lib/External/isl/interface/extract_interface.cc
+++ polly/lib/External/isl/interface/extract_interface.cc
@@ -48,7 +48,6 @@
#include <llvm/Support/raw_ostream.h>
#include <llvm/Support/CommandLine.h>
#include <llvm/Support/Host.h>
-#include <llvm/Support/ManagedStatic.h>
#include <clang/AST/ASTContext.h>
#include <clang/AST/ASTConsumer.h>
#include <clang/Basic/Builtins.h>
@@ -587,7 +586,6 @@
delete sema;
delete Clang;
- llvm::llvm_shutdown();
if (Diags.hasErrorOccurred())
return EXIT_FAILURE;
Index: mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp
===================================================================
--- mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp
+++ mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp
@@ -62,7 +62,6 @@
}
int main(int argc, char **argv) {
- llvm::llvm_shutdown_obj x;
registerPassManagerCLOptions();
llvm::InitLLVM y(argc, argv);
Index: llvm/utils/KillTheDoctor/KillTheDoctor.cpp
===================================================================
--- llvm/utils/KillTheDoctor/KillTheDoctor.cpp
+++ llvm/utils/KillTheDoctor/KillTheDoctor.cpp
@@ -36,7 +36,6 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/Signals.h"
@@ -297,7 +296,6 @@
// Print a stack trace if we signal out.
sys::PrintStackTraceOnErrorSignal(argv[0]);
PrettyStackTraceProgram X(argc, argv);
- llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
ToolName = argv[0];
Index: llvm/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
===================================================================
--- llvm/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
+++ llvm/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
@@ -9,7 +9,6 @@
#include "llvm/Support/DynamicLibrary.h"
#include "llvm/Config/config.h"
#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Path.h"
#include "gtest/gtest.h"
@@ -59,7 +58,6 @@
TEST(DynamicLibrary, Overload) {
{
std::string Err;
- llvm_shutdown_obj Shutdown;
DynamicLibrary DL =
DynamicLibrary::getPermanentLibrary(LibPath().c_str(), &Err);
EXPECT_TRUE(DL.isValid());
@@ -109,9 +107,6 @@
}
EXPECT_TRUE(FuncPtr<GetString>(DynamicLibrary::SearchForAddressOfSymbol(
"TestA")) == nullptr);
-
- // Check serach ordering is reset to default after call to llvm_shutdown
- EXPECT_EQ(DynamicLibrary::SearchOrder, DynamicLibrary::SO_Linker);
}
TEST(DynamicLibrary, Shutdown) {
@@ -119,7 +114,6 @@
std::vector<std::string> Order;
{
std::string Err;
- llvm_shutdown_obj Shutdown;
DynamicLibrary DL =
DynamicLibrary::getPermanentLibrary(LibPath(A).c_str(), &Err);
EXPECT_TRUE(DL.isValid());
Index: llvm/unittests/ExecutionEngine/ExecutionEngineTest.cpp
===================================================================
--- llvm/unittests/ExecutionEngine/ExecutionEngineTest.cpp
+++ llvm/unittests/ExecutionEngine/ExecutionEngineTest.cpp
@@ -14,7 +14,6 @@
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/DynamicLibrary.h"
-#include "llvm/Support/ManagedStatic.h"
#include "gtest/gtest.h"
using namespace llvm;
@@ -22,9 +21,6 @@
namespace {
class ExecutionEngineTest : public testing::Test {
-private:
- llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
-
protected:
ExecutionEngineTest() {
auto Owner = std::make_unique<Module>("<main>", Context);
Index: llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
===================================================================
--- llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
+++ llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
@@ -18,7 +18,6 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Format.h"
-#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/Regex.h"
@@ -435,7 +434,6 @@
// Print a stack trace if we signal out.
sys::PrintStackTraceOnErrorSignal(argv[0]);
PrettyStackTraceProgram X(argc, argv);
- llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
llvm::InitializeAllTargets();
Index: llvm/tools/gold/gold-plugin.cpp
===================================================================
--- llvm/tools/gold/gold-plugin.cpp
+++ llvm/tools/gold/gold-plugin.cpp
@@ -27,7 +27,6 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Host.h"
-#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/TargetSelect.h"
@@ -1139,7 +1138,6 @@
return LDPS_OK;
if (options::thinlto_index_only) {
- llvm_shutdown();
cleanup_hook();
exit(0);
}
@@ -1157,7 +1155,6 @@
static ld_plugin_status all_symbols_read_hook(void) {
ld_plugin_status Ret = allSymbolsReadHook();
- llvm_shutdown();
if (options::TheOutputType == options::OT_BC_ONLY ||
options::TheOutputType == options::OT_ASM_ONLY ||
Index: llvm/lib/Support/Windows/DynamicLibrary.inc
===================================================================
--- llvm/lib/Support/Windows/DynamicLibrary.inc
+++ llvm/lib/Support/Windows/DynamicLibrary.inc
@@ -28,7 +28,7 @@
// 'Process' should not be released on Windows.
assert((!Process || Process==this) && "Bad Handle");
- // llvm_shutdown called, Return to default
+ // Global destructors run, Return to default
DynamicLibrary::SearchOrder = DynamicLibrary::SO_Linker;
}
Index: llvm/lib/Support/Unix/Signals.inc
===================================================================
--- llvm/lib/Support/Unix/Signals.inc
+++ llvm/lib/Support/Unix/Signals.inc
@@ -13,13 +13,7 @@
//
// This file is extremely careful to only do signal-safe things while in a
// signal handler. In particular, memory allocation and acquiring a mutex
-// while in a signal handler should never occur. ManagedStatic isn't usable from
-// a signal handler for 2 reasons:
-//
-// 1. Creating a new one allocates.
-// 2. The signal handler could fire while llvm_shutdown is being processed, in
-// which case the ManagedStatic is in an unknown state because it could
-// already have been destroyed, or be in the process of being destroyed.
+// while in a signal handler should never occur.
//
// Modifying the behavior of the signal handlers (such as registering new ones)
// can acquire a mutex, but all this guarantees is that the signal handler
@@ -191,8 +185,9 @@
static std::atomic<FileToRemoveList *> FilesToRemove = ATOMIC_VAR_INIT(nullptr);
/// Clean up the list in a signal-friendly manner.
-/// Recall that signals can fire during llvm_shutdown. If this occurs we should
-/// either clean something up or nothing at all, but we shouldn't crash!
+/// Recall that signals can fire while global destructors are run. If this
+/// occurs we should either clean something up or nothing at all, but we
+/// shouldn't crash!
struct FilesToRemoveCleanup {
// Not signal-safe.
~FilesToRemoveCleanup() {
Index: llvm/lib/Support/Unix/DynamicLibrary.inc
===================================================================
--- llvm/lib/Support/Unix/DynamicLibrary.inc
+++ llvm/lib/Support/Unix/DynamicLibrary.inc
@@ -20,7 +20,7 @@
if (Process)
::dlclose(Process);
- // llvm_shutdown called, Return to default
+ // Global destructors run, Return to default
DynamicLibrary::SearchOrder = DynamicLibrary::SO_Linker;
}
Index: llvm/lib/Support/InitLLVM.cpp
===================================================================
--- llvm/lib/Support/InitLLVM.cpp
+++ llvm/lib/Support/InitLLVM.cpp
@@ -9,7 +9,6 @@
#include "llvm/Support/InitLLVM.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/SwapByteOrder.h"
@@ -60,5 +59,3 @@
Argv = Args.data();
#endif
}
-
-InitLLVM::~InitLLVM() { llvm_shutdown(); }
Index: llvm/lib/IR/Pass.cpp
===================================================================
--- llvm/lib/IR/Pass.cpp
+++ llvm/lib/IR/Pass.cpp
@@ -227,8 +227,8 @@
}
// This only gets called during static destruction, in which case the
-// PassRegistry will have already been destroyed by llvm_shutdown(). So
-// attempting to remove the registration listener is an error.
+// PassRegistry may have already been destroyed. So attempting to remove the
+// registration listener is an error (and also unnecessary).
PassNameParser::~PassNameParser() = default;
//===----------------------------------------------------------------------===//
Index: llvm/include/llvm/Support/InitLLVM.h
===================================================================
--- llvm/include/llvm/Support/InitLLVM.h
+++ llvm/include/llvm/Support/InitLLVM.h
@@ -29,8 +29,6 @@
// encoding, so that you can assume that command line arguments are
// always encoded in UTF-8 on any platform.
//
-// InitLLVM calls llvm_shutdown() on destruction, which cleans up
-// ManagedStatic objects.
namespace llvm {
class InitLLVM {
public:
@@ -40,8 +38,6 @@
: InitLLVM(Argc, const_cast<const char **&>(Argv),
InstallPipeSignalExitHandler) {}
- ~InitLLVM();
-
private:
BumpPtrAllocator Alloc;
SmallVector<const char *, 0> Args;
Index: llvm/include/llvm/Support/DynamicLibrary.h
===================================================================
--- llvm/include/llvm/Support/DynamicLibrary.h
+++ llvm/include/llvm/Support/DynamicLibrary.h
@@ -57,7 +57,8 @@
void *getAddressOfSymbol(const char *symbolName);
/// This function permanently loads the dynamic library at the given path.
- /// The library will only be unloaded when llvm_shutdown() is called.
+ /// The library will only be unloaded when LLVM's global destructors are
+ /// run.
/// This returns a valid DynamicLibrary instance on success and an invalid
/// instance on failure (see isValid()). \p *errMsg will only be modified
/// if the library fails to load.
Index: llvm/include/llvm/PassRegistry.h
===================================================================
--- llvm/include/llvm/PassRegistry.h
+++ llvm/include/llvm/PassRegistry.h
@@ -53,8 +53,8 @@
~PassRegistry();
/// getPassRegistry - Access the global registry object, which is
- /// automatically initialized at application launch and destroyed by
- /// llvm_shutdown.
+ /// automatically initialized at application launch and destroyed when
+ /// global destructors are run.
static PassRegistry *getPassRegistry();
/// getPassInfo - Look up a pass' corresponding PassInfo, indexed by the pass'
Index: llvm/examples/HowToUseJIT/HowToUseJIT.cpp
===================================================================
--- llvm/examples/HowToUseJIT/HowToUseJIT.cpp
+++ llvm/examples/HowToUseJIT/HowToUseJIT.cpp
@@ -48,7 +48,6 @@
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/Support/Casting.h"
-#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
@@ -135,6 +134,5 @@
// Import result of execution:
outs() << "Result: " << gv.IntVal << "\n";
delete EE;
- llvm_shutdown();
return 0;
}
Index: llvm/examples/BrainF/BrainFDriver.cpp
===================================================================
--- llvm/examples/BrainF/BrainFDriver.cpp
+++ llvm/examples/BrainF/BrainFDriver.cpp
@@ -41,7 +41,6 @@
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
@@ -180,7 +179,5 @@
if (out != &outs())
delete out;
- llvm_shutdown();
-
return 0;
}
Index: lldb/utils/TableGen/LLDBTableGen.cpp
===================================================================
--- lldb/utils/TableGen/LLDBTableGen.cpp
+++ lldb/utils/TableGen/LLDBTableGen.cpp
@@ -68,8 +68,6 @@
PrettyStackTraceProgram X(argc, argv);
cl::ParseCommandLineOptions(argc, argv);
- llvm_shutdown_obj Y;
-
return TableGenMain(argv[0], &LLDBTableGenMain);
}
Index: lldb/unittests/Utility/LogTest.cpp
===================================================================
--- lldb/unittests/Utility/LogTest.cpp
+++ lldb/unittests/Utility/LogTest.cpp
@@ -12,7 +12,6 @@
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
#include "llvm/ADT/BitmaskEnum.h"
-#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Threading.h"
#include <thread>
@@ -72,7 +71,6 @@
static void TearDownTestCase() {
Log::Unregister("chan");
- llvm::llvm_shutdown();
}
};
@@ -142,7 +140,6 @@
}
TEST(LogTest, Register) {
- llvm::llvm_shutdown_obj obj;
Log::Register("chan", test_channel);
Log::Unregister("chan");
Log::Register("chan", test_channel);
@@ -150,7 +147,6 @@
}
TEST(LogTest, Unregister) {
- llvm::llvm_shutdown_obj obj;
Log::Register("chan", test_channel);
EXPECT_EQ(nullptr, GetLog(TestChannel::FOO));
std::string message;
Index: lldb/tools/lldb-test/lldb-test.cpp
===================================================================
--- lldb/tools/lldb-test/lldb-test.cpp
+++ lldb/tools/lldb-test/lldb-test.cpp
@@ -37,7 +37,6 @@
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/PrettyStackTrace.h"
@@ -1091,7 +1090,6 @@
StringRef ToolName = argv[0];
sys::PrintStackTraceOnErrorSignal(ToolName);
PrettyStackTraceProgram X(argc, argv);
- llvm_shutdown_obj Y;
cl::ParseCommandLineOptions(argc, argv, "LLDB Testing Utility\n");
Index: lldb/tools/driver/Driver.cpp
===================================================================
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -780,8 +780,7 @@
std::setlocale(LC_ALL, "");
std::setlocale(LC_CTYPE, "");
- // Setup LLVM signal handlers and make sure we call llvm_shutdown() on
- // destruction.
+ // Setup LLVM signal handlers.
llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);
// Parse arguments.
Index: libclc/utils/prepare-builtins.cpp
===================================================================
--- libclc/utils/prepare-builtins.cpp
+++ libclc/utils/prepare-builtins.cpp
@@ -10,7 +10,6 @@
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/raw_ostream.h"
@@ -31,7 +30,6 @@
int main(int argc, char **argv) {
LLVMContext Context;
- llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
cl::ParseCommandLineOptions(argc, argv, "libclc builtin preparation tool\n");
Index: clang/utils/TableGen/TableGen.cpp
===================================================================
--- clang/utils/TableGen/TableGen.cpp
+++ clang/utils/TableGen/TableGen.cpp
@@ -485,8 +485,6 @@
PrettyStackTraceProgram X(argc, argv);
cl::ParseCommandLineOptions(argc, argv);
- llvm_shutdown_obj Y;
-
return TableGenMain(argv[0], &ClangTableGenMain);
}
Index: clang/unittests/Interpreter/InterpreterTest.cpp
===================================================================
--- clang/unittests/Interpreter/InterpreterTest.cpp
+++ clang/unittests/Interpreter/InterpreterTest.cpp
@@ -188,7 +188,6 @@
llvm::InitializeNativeTarget();
llvm::InitializeNativeTargetAsmPrinter();
}
- ~LLVMInitRAII() { llvm::llvm_shutdown(); }
} LLVMInit;
#ifdef _AIX
Index: clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
===================================================================
--- clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
+++ clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
@@ -23,7 +23,6 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ExecutionEngine/Orc/LLJIT.h"
-#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm-c/Error.h"
@@ -131,8 +130,6 @@
EXPECT_ANY_THROW(ThrowException());
std::string CapturedStdOut = testing::internal::GetCapturedStdout();
EXPECT_EQ(CapturedStdOut, "Caught: 'To be caught in JIT'\n");
-
- llvm::llvm_shutdown();
}
} // end anonymous namespace
Index: clang/tools/clang-repl/ClangRepl.cpp
===================================================================
--- clang/tools/clang-repl/ClangRepl.cpp
+++ clang/tools/clang-repl/ClangRepl.cpp
@@ -18,7 +18,6 @@
#include "llvm/ExecutionEngine/Orc/LLJIT.h"
#include "llvm/LineEditor/LineEditor.h"
#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/ManagedStatic.h" // llvm_shutdown
#include "llvm/Support/Signals.h"
#include "llvm/Support/TargetSelect.h" // llvm::Initialize*
@@ -127,7 +126,5 @@
// later errors use the default handling behavior instead.
llvm::remove_fatal_error_handler();
- llvm::llvm_shutdown();
-
return checkDiagErrors(Interp->getCompilerInstance());
}
Index: clang/include/clang/Frontend/CompilerInstance.h
===================================================================
--- clang/include/clang/Frontend/CompilerInstance.h
+++ clang/include/clang/Frontend/CompilerInstance.h
@@ -205,16 +205,10 @@
/// - Clients should have initialized any LLVM target features that may be
/// required.
///
- /// - Clients should eventually call llvm_shutdown() upon the completion of
- /// this routine to ensure that any managed objects are properly destroyed.
- ///
/// Note that this routine may write output to 'stderr'.
///
/// \param Act - The action to execute.
/// \return - True on success.
- //
- // FIXME: Eliminate the llvm_shutdown requirement, that should either be part
- // of the context or else not CompilerInstance specific.
bool ExecuteAction(FrontendAction &Act);
/// Load the list of plugins requested in the \c FrontendOptions.
Index: bolt/tools/merge-fdata/merge-fdata.cpp
===================================================================
--- bolt/tools/merge-fdata/merge-fdata.cpp
+++ bolt/tools/merge-fdata/merge-fdata.cpp
@@ -315,8 +315,6 @@
sys::PrintStackTraceOnErrorSignal(argv[0]);
PrettyStackTraceProgram X(argc, argv);
- llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
-
cl::HideUnrelatedOptions(opts::MergeFdataCategory);
cl::ParseCommandLineOptions(argc, argv,
Index: bolt/tools/driver/llvm-bolt.cpp
===================================================================
--- bolt/tools/driver/llvm-bolt.cpp
+++ bolt/tools/driver/llvm-bolt.cpp
@@ -182,8 +182,6 @@
sys::PrintStackTraceOnErrorSignal(argv[0]);
PrettyStackTraceProgram X(argc, argv);
- llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
-
std::string ToolPath = GetExecutablePath(argv[0]);
// Initialize targets and assembly printers/parsers.
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits