Not having an aliasee is a theoretical possibility.
authorDuncan Sands <baldrick@free.fr>
Mon, 5 Jan 2009 20:47:56 +0000 (20:47 +0000)
committerDuncan Sands <baldrick@free.fr>
Mon, 5 Jan 2009 20:47:56 +0000 (20:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61745 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/GlobalDCE.cpp

index a9c9ec0fd844abc66bd55150834c3f2a9caba936..654a5095d062d9711a753cf800df8cd6217f838a 100644 (file)
@@ -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