summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/IPO/GlobalDCE.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Transforms/IPO/GlobalDCE.cpp b/lib/Transforms/IPO/GlobalDCE.cpp
index a9c9ec0fd8..654a5095d0 100644
--- a/lib/Transforms/IPO/GlobalDCE.cpp
+++ b/lib/Transforms/IPO/GlobalDCE.cpp
@@ -161,7 +161,8 @@ void GlobalDCE::GlobalIsNeeded(GlobalValue *G) {
MarkUsedGlobalsAsNeeded(GV->getInitializer());
} else if (GlobalAlias *GA = dyn_cast<GlobalAlias>(G)) {
// The target of a global alias is needed.
- MarkUsedGlobalsAsNeeded(GA->getAliasee());
+ if (Constant *Aliasee = GA->getAliasee())
+ MarkUsedGlobalsAsNeeded(Aliasee);
} else {
// Otherwise this must be a function object. We have to scan the body of
// the function looking for constants and global values which are used as