[SplitModule] In split module utility we should never separate alias with its aliasee.
Summary: When splitting module with preserving locals, we currently do not handle case of global alias being separated with its aliasee.
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D16585
llvm-svn: 259075
diff --git a/llvm/lib/Transforms/Utils/SplitModule.cpp b/llvm/lib/Transforms/Utils/SplitModule.cpp
index b3d0f52..dcb2307 100644
--- a/llvm/lib/Transforms/Utils/SplitModule.cpp
+++ b/llvm/lib/Transforms/Utils/SplitModule.cpp
@@ -88,6 +88,13 @@
Member = &GV;
}
+ // For aliases we should not separate them from their aliasees regardless
+ // of linkage.
+ if (GlobalAlias *GA = dyn_cast<GlobalAlias>(&GV)) {
+ if (const GlobalObject *Base = GA->getBaseObject())
+ GVtoClusterMap.unionSets(&GV, Base);
+ }
+
// Further only iterate over local GVs.
if (!GV.hasLocalLinkage())
return;