[PATCH] D38602: ModuleUtils: Stop using comdat members to generate unique module ids.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 5 14:56:40 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL315026: ModuleUtils: Stop using comdat members to generate unique module ids. (authored by pcc).

Changed prior to commit:
  https://reviews.llvm.org/D38602?vs=117901&id=117906#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D38602

Files:
  llvm/trunk/include/llvm/Transforms/Utils/ModuleUtils.h
  llvm/trunk/lib/Transforms/Utils/ModuleUtils.cpp
  llvm/trunk/test/Transforms/ThinLTOBitcodeWriter/filter-alias.ll
  llvm/trunk/test/Transforms/ThinLTOBitcodeWriter/unsplittable.ll


Index: llvm/trunk/lib/Transforms/Utils/ModuleUtils.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Utils/ModuleUtils.cpp
+++ llvm/trunk/lib/Transforms/Utils/ModuleUtils.cpp
@@ -243,7 +243,7 @@
   bool ExportsSymbols = false;
   auto AddGlobal = [&](GlobalValue &GV) {
     if (GV.isDeclaration() || GV.getName().startswith("llvm.") ||
-        !GV.hasExternalLinkage())
+        !GV.hasExternalLinkage() || GV.hasComdat())
       return;
     ExportsSymbols = true;
     Md5.update(GV.getName());
Index: llvm/trunk/include/llvm/Transforms/Utils/ModuleUtils.h
===================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/ModuleUtils.h
+++ llvm/trunk/include/llvm/Transforms/Utils/ModuleUtils.h
@@ -85,7 +85,8 @@
     Module &M, SmallVectorImpl<Function *> &DeadComdatFunctions);
 
 /// \brief Produce a unique identifier for this module by taking the MD5 sum of
-/// the names of the module's strong external symbols.
+/// the names of the module's strong external symbols that are not comdat
+/// members.
 ///
 /// This identifier is normally guaranteed to be unique, or the program would
 /// fail to link due to multiply defined symbols.
Index: llvm/trunk/test/Transforms/ThinLTOBitcodeWriter/unsplittable.ll
===================================================================
--- llvm/trunk/test/Transforms/ThinLTOBitcodeWriter/unsplittable.ll
+++ llvm/trunk/test/Transforms/ThinLTOBitcodeWriter/unsplittable.ll
@@ -21,4 +21,10 @@
   ret void
 }
 
+$h = comdat any
+; CHECK: define void @h() comdat
+define void @h() comdat {
+  ret void
+}
+
 !0 = !{i32 0, !"typeid"}
Index: llvm/trunk/test/Transforms/ThinLTOBitcodeWriter/filter-alias.ll
===================================================================
--- llvm/trunk/test/Transforms/ThinLTOBitcodeWriter/filter-alias.ll
+++ llvm/trunk/test/Transforms/ThinLTOBitcodeWriter/filter-alias.ll
@@ -13,4 +13,6 @@
 
 @al = external unnamed_addr alias i8*, getelementptr inbounds ({ [1 x i8*] }, { [1 x i8*] }* @anon, i32 0, i32 0, i32 1)
 
+ at foo = global i32 1
+
 !0 = !{i64 8, !"?AVA@@"}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38602.117906.patch
Type: text/x-patch
Size: 2147 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171005/6e79495c/attachment.bin>


More information about the llvm-commits mailing list