[PATCH] D31444: LTO: call getRealLinkageName on IRNames before feeding to getGUID

Bob Haarman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 28 16:20:43 PDT 2017


inglorion created this revision.
Herald added a subscriber: mehdi_amini.

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.


https://reviews.llvm.org/D31444

Files:
  lib/LTO/LTO.cpp


Index: lib/LTO/LTO.cpp
===================================================================
--- lib/LTO/LTO.cpp
+++ lib/LTO/LTO.cpp
@@ -1013,7 +1013,7 @@
           // 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 =
@@ -1032,10 +1032,10 @@
       // 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,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31444.93318.patch
Type: text/x-patch
Size: 1135 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170328/2064936d/attachment.bin>


More information about the llvm-commits mailing list