From 52e5deece5b99ff5d2ca5547c4c894397da1be41 Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Mon, 5 Jan 2009 20:47:56 +0000 Subject: [PATCH] Not having an aliasee is a theoretical possibility. llvm-svn: 61745 --- llvm/lib/Transforms/IPO/GlobalDCE.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Transforms/IPO/GlobalDCE.cpp b/llvm/lib/Transforms/IPO/GlobalDCE.cpp index a9c9ec0fd844..654a5095d062 100644 --- a/llvm/lib/Transforms/IPO/GlobalDCE.cpp +++ b/llvm/lib/Transforms/IPO/GlobalDCE.cpp @@ -161,7 +161,8 @@ void GlobalDCE::GlobalIsNeeded(GlobalValue *G) { MarkUsedGlobalsAsNeeded(GV->getInitializer()); } else if (GlobalAlias *GA = dyn_cast(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