forked from OSchip/llvm-project
teach Value::isDereferenceablePointer that byval arguments are always
dereferencable, noticed by inspection. llvm-svn: 124085
This commit is contained in:
parent
1e7a9ee7d0
commit
9879965f4b
|
@ -363,6 +363,10 @@ bool Value::isDereferenceablePointer() const {
|
||||||
if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(this))
|
if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(this))
|
||||||
return !GV->hasExternalWeakLinkage();
|
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.
|
// For GEPs, determine if the indexing lands within the allocated object.
|
||||||
if (const GEPOperator *GEP = dyn_cast<GEPOperator>(this)) {
|
if (const GEPOperator *GEP = dyn_cast<GEPOperator>(this)) {
|
||||||
// Conservatively require that the base pointer be fully dereferenceable.
|
// Conservatively require that the base pointer be fully dereferenceable.
|
||||||
|
|
Loading…
Reference in New Issue