summaryrefslogtreecommitdiff
path: root/lib/VMCore/Value.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-01-23 21:15:29 +0000
committerChris Lattner <sabre@nondot.org>2011-01-23 21:15:29 +0000
commit3928af6ac47f9abef7dff32823a5fd41743c8fbc (patch)
treeccbc11ff6271abccd2224df78f449457789645c2 /lib/VMCore/Value.cpp
parentf330b3227ad8b381aebf267acddf8f244f556f6b (diff)
downloadllvm-3928af6ac47f9abef7dff32823a5fd41743c8fbc.tar.gz
llvm-3928af6ac47f9abef7dff32823a5fd41743c8fbc.tar.bz2
llvm-3928af6ac47f9abef7dff32823a5fd41743c8fbc.tar.xz
teach Value::isDereferenceablePointer that byval arguments are always
dereferencable, noticed by inspection. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124085 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Value.cpp')
-rw-r--r--lib/VMCore/Value.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp
index 38438265dd..29f6a8094f 100644
--- a/lib/VMCore/Value.cpp
+++ b/lib/VMCore/Value.cpp
@@ -363,6 +363,10 @@ bool Value::isDereferenceablePointer() const {
if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(this))
return !GV->hasExternalWeakLinkage();
+ // byval arguments are ok.
+ if (const Argument *A = dyn_cast<Argument>(this))
+ return A->hasByValAttr();
+
// For GEPs, determine if the indexing lands within the allocated object.
if (const GEPOperator *GEP = dyn_cast<GEPOperator>(this)) {
// Conservatively require that the base pointer be fully dereferenceable.