From: Chris Lattner Date: Sun, 23 Jan 2011 21:15:29 +0000 (+0000) Subject: teach Value::isDereferenceablePointer that byval arguments are always X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3928af6ac47f9abef7dff32823a5fd41743c8fbc;p=oota-llvm.git 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 --- diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp index 38438265dd6..29f6a8094f0 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(this)) return !GV->hasExternalWeakLinkage(); + // byval arguments are ok. + if (const Argument *A = dyn_cast(this)) + return A->hasByValAttr(); + // For GEPs, determine if the indexing lands within the allocated object. if (const GEPOperator *GEP = dyn_cast(this)) { // Conservatively require that the base pointer be fully dereferenceable.