diff --git a/llvm/lib/VMCore/Value.cpp b/llvm/lib/VMCore/Value.cpp index 38438265dd62..29f6a8094f0b 100644 --- a/llvm/lib/VMCore/Value.cpp +++ b/llvm/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.