aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/Value.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-08-27 17:55:13 +0000
committerDan Gohman <gohman@apple.com>2009-08-27 17:55:13 +0000
commitc99596ddbf78116260c177edcfad9261bf186b68 (patch)
treef1d49b4923e81e779b8c33dba56ef35c281f9553 /lib/VMCore/Value.cpp
parentfe1256903404065be182735c1402411c4940e9e5 (diff)
downloadexternal_llvm-c99596ddbf78116260c177edcfad9261bf186b68.zip
external_llvm-c99596ddbf78116260c177edcfad9261bf186b68.tar.gz
external_llvm-c99596ddbf78116260c177edcfad9261bf186b68.tar.bz2
Teach getUnderlyingObject and skipPointerCasts about GlobalAliases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80265 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Value.cpp')
-rw-r--r--lib/VMCore/Value.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp
index 34291b9..f674062 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<Operator>(V)->getOperand(0);
+ } else if (GlobalAlias *GA = dyn_cast<GlobalAlias>(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<Operator>(V)->getOperand(0);
+ } else if (GlobalAlias *GA = dyn_cast<GlobalAlias>(V)) {
+ if (GA->mayBeOverridden())
+ return V;
+ V = GA->getAliasee();
} else {
return V;
}