From a4619d9944c7e54c421582c7dc592ae051d8bf51 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Fri, 2 Mar 2018 23:40:08 +0000 Subject: [ThinLTO] Revert r325320: Import global variables This caused some links to fail with ThinLTO due to missing symbols as well as causing some binaries to have failures at runtime. We're working with the author to get a test case, but want to get the tree green again. Further, it appears to introduce a data race. While the test usage of threads was disabled in r325361 & r325362, that isn't an acceptable fix. I've reverted both of these as well. This code needs to be thread safe. Test cases for this are already on the original commit thread. llvm-svn: 326638 --- llvm/lib/Linker/IRMover.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Linker') diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp index 42081442db7..ec15bbfc658 100644 --- a/llvm/lib/Linker/IRMover.cpp +++ b/llvm/lib/Linker/IRMover.cpp @@ -1051,10 +1051,14 @@ void IRLinker::prepareCompileUnitsForImport() { ValueMap.MD()[CU->getRawEnumTypes()].reset(nullptr); ValueMap.MD()[CU->getRawMacros()].reset(nullptr); ValueMap.MD()[CU->getRawRetainedTypes()].reset(nullptr); - // We import global variables only temporarily in order for instcombine - // and globalopt to perform constant folding and static constructor - // evaluation. After that elim-avail-extern will covert imported globals - // back to declarations, so we don't need debug info for them. + // If we ever start importing global variable defs, we'll need to + // add their DIGlobalVariable to the globals list on the imported + // DICompileUnit. Confirm none are imported, and then we can + // map the list of global variables to nullptr. + assert(none_of( + ValuesToLink, + [](const GlobalValue *GV) { return isa(GV); }) && + "Unexpected importing of a GlobalVariable definition"); ValueMap.MD()[CU->getRawGlobalVariables()].reset(nullptr); // Imported entities only need to be mapped in if they have local -- cgit v1.2.3