diff options
author | Chris Lattner <sabre@nondot.org> | 2007-05-05 23:49:02 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-05-05 23:49:02 +0000 |
commit | 2bf6e6a632b445b363707f99aa35ca304e7a9176 (patch) | |
tree | 93929d11c52385250fec3212c412086aaf19e40d /lib | |
parent | 8f57667a5d79faa3bb0644b051ed28b071659fd9 (diff) |
handle gep aliasee
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36815 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VMCore/Globals.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/VMCore/Globals.cpp b/lib/VMCore/Globals.cpp index 021d6bf801..eb0df60757 100644 --- a/lib/VMCore/Globals.cpp +++ b/lib/VMCore/Globals.cpp @@ -210,7 +210,7 @@ void GlobalAlias::setAliasee(Constant *Aliasee) setOperand(0, Aliasee); } -const GlobalValue *GlobalAlias::getAliasedGlobal() const { +const GlobalValue *GlobalAlias::getAliasedGlobal() const { const Constant *C = getAliasee(); if (C) { if (const GlobalValue *GV = dyn_cast<GlobalValue>(C)) @@ -218,8 +218,9 @@ const GlobalValue *GlobalAlias::getAliasedGlobal() const { else { const ConstantExpr *CE = 0; if ((CE = dyn_cast<ConstantExpr>(C)) && - (CE->getOpcode() == Instruction::BitCast)) - return cast<GlobalValue>(CE->getOperand(0)); + (CE->getOpcode() == Instruction::BitCast || + CE->getOpcode() == Instruction::GetElementPtr)) + return dyn_cast<GlobalValue>(CE->getOperand(0)); else assert(0 && "Unsupported aliasee"); } |