[llvm] r299268 - LTO: call getRealLinkageName on IRNames before feeding to getGUID
Bob Haarman via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 31 14:56:31 PDT 2017
Author: inglorion
Date: Fri Mar 31 16:56:30 2017
New Revision: 299268
URL: http://llvm.org/viewvc/llvm-project?rev=299268&view=rev
Log:
LTO: call getRealLinkageName on IRNames before feeding to getGUID
Summary: GlobalValue has two getGUID methods: an instance method and a static method. The static method takes a string, which is expected to be what GlobalValue::getRealLinkageName() would return. In LTO.cpp, we were not doing this consistently, sometimes passing an IR name instead. This change makes it so that we call getRealLinkageName() first, making the static getGUID return value consistent with the instance method. Without this change, compiling FileCheck with ThinLTO on Windows fails with numerous undefined symbol errors. With the change, it builds successfully.
Reviewers: pcc, rnk
Reviewed By: pcc
Subscribers: tejohnson, mehdi_amini, llvm-commits
Differential Revision: https://reviews.llvm.org/D31444
Modified:
llvm/trunk/lib/LTO/LTO.cpp
Modified: llvm/trunk/lib/LTO/LTO.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTO.cpp?rev=299268&r1=299267&r2=299268&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/LTO.cpp (original)
+++ llvm/trunk/lib/LTO/LTO.cpp Fri Mar 31 16:56:30 2017
@@ -971,7 +971,8 @@ Error LTO::runThinLTO(AddStreamFn AddStr
// IRName will be defined if we have seen the prevailing copy of
// this value. If not, no need to preserve any ThinLTO copies.
!Res.second.IRName.empty())
- GUIDPreservedSymbols.insert(GlobalValue::getGUID(Res.second.IRName));
+ GUIDPreservedSymbols.insert(GlobalValue::getGUID(
+ GlobalValue::getRealLinkageName(Res.second.IRName)));
}
auto DeadSymbols =
@@ -990,10 +991,11 @@ Error LTO::runThinLTO(AddStreamFn AddStr
// partition (and we can't get the GUID).
if (Res.second.IRName.empty())
continue;
- auto GUID = GlobalValue::getGUID(Res.second.IRName);
+ auto GUID = GlobalValue::getGUID(
+ GlobalValue::getRealLinkageName(Res.second.IRName));
// Mark exported unless index-based analysis determined it to be dead.
if (!DeadSymbols.count(GUID))
- ExportedGUIDs.insert(GlobalValue::getGUID(Res.second.IRName));
+ ExportedGUIDs.insert(GUID);
}
auto isPrevailing = [&](GlobalValue::GUID GUID,
More information about the llvm-commits
mailing list