diff options
author | Nuno Lopes <nunoplopes@sapo.pt> | 2012-12-31 16:23:48 +0000 |
---|---|---|
committer | Nuno Lopes <nunoplopes@sapo.pt> | 2012-12-31 16:23:48 +0000 |
commit | 41be2fb1f9e9b8f796effb81c2bee6cf397136cf (patch) | |
tree | 1b6197bc9acafa458cb291491699ede4902b5dc9 /lib/Analysis | |
parent | 148ee4f224be6448834bf039807c70bb1a7c78f5 (diff) | |
download | external_llvm-41be2fb1f9e9b8f796effb81c2bee6cf397136cf.zip external_llvm-41be2fb1f9e9b8f796effb81c2bee6cf397136cf.tar.gz external_llvm-41be2fb1f9e9b8f796effb81c2bee6cf397136cf.tar.bz2 |
add support for GlobalAlias to ObjectSizeOffsetVisitor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171303 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/MemoryBuiltins.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Analysis/MemoryBuiltins.cpp b/lib/Analysis/MemoryBuiltins.cpp index 2503bfa..a565617 100644 --- a/lib/Analysis/MemoryBuiltins.cpp +++ b/lib/Analysis/MemoryBuiltins.cpp @@ -399,6 +399,8 @@ SizeOffsetType ObjectSizeOffsetVisitor::compute(Value *V) { return visitArgument(*A); if (ConstantPointerNull *P = dyn_cast<ConstantPointerNull>(V)) return visitConstantPointerNull(*P); + if (GlobalAlias *GA = dyn_cast<GlobalAlias>(V)) + return visitGlobalAlias(*GA); if (GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) return visitGlobalVariable(*GV); if (UndefValue *UV = dyn_cast<UndefValue>(V)) @@ -517,6 +519,12 @@ SizeOffsetType ObjectSizeOffsetVisitor::visitGEPOperator(GEPOperator &GEP) { return std::make_pair(PtrData.first, PtrData.second + Offset); } +SizeOffsetType ObjectSizeOffsetVisitor::visitGlobalAlias(GlobalAlias &GA) { + if (GA.mayBeOverridden()) + return unknown(); + return compute(GA.getAliasee()); +} + SizeOffsetType ObjectSizeOffsetVisitor::visitGlobalVariable(GlobalVariable &GV){ if (!GV.hasDefinitiveInitializer()) return unknown(); @@ -629,6 +637,7 @@ SizeOffsetEvalType ObjectSizeOffsetEvaluator::compute_(Value *V) { } else if (isa<Argument>(V) || (isa<ConstantExpr>(V) && cast<ConstantExpr>(V)->getOpcode() == Instruction::IntToPtr) || + isa<GlobalAlias>(V) || isa<GlobalVariable>(V)) { // ignore values where we cannot do more than what ObjectSizeVisitor can Result = unknown(); |