summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/Transforms/Utils/ModuleUtils.h3
-rw-r--r--llvm/lib/Transforms/Utils/ModuleUtils.cpp2
-rw-r--r--llvm/test/Transforms/ThinLTOBitcodeWriter/filter-alias.ll2
-rw-r--r--llvm/test/Transforms/ThinLTOBitcodeWriter/unsplittable.ll6
4 files changed, 11 insertions, 2 deletions
diff --git a/llvm/include/llvm/Transforms/Utils/ModuleUtils.h b/llvm/include/llvm/Transforms/Utils/ModuleUtils.h
index e9793fe4b66..4b9bc829381 100644
--- a/llvm/include/llvm/Transforms/Utils/ModuleUtils.h
+++ b/llvm/include/llvm/Transforms/Utils/ModuleUtils.h
@@ -85,7 +85,8 @@ void filterDeadComdatFunctions(
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.
diff --git a/llvm/lib/Transforms/Utils/ModuleUtils.cpp b/llvm/lib/Transforms/Utils/ModuleUtils.cpp
index 2ef3d6336ae..ba4b7f3cc26 100644
--- a/llvm/lib/Transforms/Utils/ModuleUtils.cpp
+++ b/llvm/lib/Transforms/Utils/ModuleUtils.cpp
@@ -243,7 +243,7 @@ std::string llvm::getUniqueModuleId(Module *M) {
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());
diff --git a/llvm/test/Transforms/ThinLTOBitcodeWriter/filter-alias.ll b/llvm/test/Transforms/ThinLTOBitcodeWriter/filter-alias.ll
index d555ab0c1f6..48f2900da36 100644
--- a/llvm/test/Transforms/ThinLTOBitcodeWriter/filter-alias.ll
+++ b/llvm/test/Transforms/ThinLTOBitcodeWriter/filter-alias.ll
@@ -13,4 +13,6 @@ $al = comdat any
@al = external unnamed_addr alias i8*, getelementptr inbounds ({ [1 x i8*] }, { [1 x i8*] }* @anon, i32 0, i32 0, i32 1)
+@foo = global i32 1
+
!0 = !{i64 8, !"?AVA@@"}
diff --git a/llvm/test/Transforms/ThinLTOBitcodeWriter/unsplittable.ll b/llvm/test/Transforms/ThinLTOBitcodeWriter/unsplittable.ll
index 718013e39b3..41b5bba79ad 100644
--- a/llvm/test/Transforms/ThinLTOBitcodeWriter/unsplittable.ll
+++ b/llvm/test/Transforms/ThinLTOBitcodeWriter/unsplittable.ll
@@ -21,4 +21,10 @@ define internal void @f() {
ret void
}
+$h = comdat any
+; CHECK: define void @h() comdat
+define void @h() comdat {
+ ret void
+}
+
!0 = !{i32 0, !"typeid"}
OpenPOWER on IntegriCloud