Skip to content

Commit 52e5dee

Browse files
Not having an aliasee is a theoretical possibility.
llvm-svn: 61745
1 parent 821d13c commit 52e5dee

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/lib/Transforms/IPO/GlobalDCE.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ void GlobalDCE::GlobalIsNeeded(GlobalValue *G) {
161161
MarkUsedGlobalsAsNeeded(GV->getInitializer());
162162
} else if (GlobalAlias *GA = dyn_cast<GlobalAlias>(G)) {
163163
// The target of a global alias is needed.
164-
MarkUsedGlobalsAsNeeded(GA->getAliasee());
164+
if (Constant *Aliasee = GA->getAliasee())
165+
MarkUsedGlobalsAsNeeded(Aliasee);
165166
} else {
166167
// Otherwise this must be a function object. We have to scan the body of
167168
// the function looking for constants and global values which are used as

0 commit comments

Comments
 (0)