From: Dan Gohman Date: Thu, 27 Aug 2009 17:55:13 +0000 (+0000) Subject: Teach getUnderlyingObject and skipPointerCasts about GlobalAliases. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=aac1bfb99a7a43ce145748f41f64f970f5499de6;p=oota-llvm.git Teach getUnderlyingObject and skipPointerCasts about GlobalAliases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80265 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp index 34291b9d728..f6740626096 100644 --- a/lib/VMCore/Value.cpp +++ b/lib/VMCore/Value.cpp @@ -340,6 +340,10 @@ Value *Value::stripPointerCasts() { V = GEP->getPointerOperand(); } else if (Operator::getOpcode(V) == Instruction::BitCast) { V = cast(V)->getOperand(0); + } else if (GlobalAlias *GA = dyn_cast(V)) { + if (GA->mayBeOverridden()) + return V; + V = GA->getAliasee(); } else { return V; } @@ -357,6 +361,10 @@ Value *Value::getUnderlyingObject() { V = GEP->getPointerOperand(); } else if (Operator::getOpcode(V) == Instruction::BitCast) { V = cast(V)->getOperand(0); + } else if (GlobalAlias *GA = dyn_cast(V)) { + if (GA->mayBeOverridden()) + return V; + V = GA->getAliasee(); } else { return V; }