Add a dereferenceable attribute

This attribute indicates that the parameter or return pointer is
dereferenceable. Practically speaking, loads from such a pointer within the
associated byte range are safe to speculatively execute. Such pointer
parameters are common in source languages (C++ references, for example).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213385 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Hal Finkel
2014-07-18 15:51:28 +00:00
parent a11bf68f6c
commit 11af4b49b2
22 changed files with 388 additions and 18 deletions

View File

@ -2086,7 +2086,7 @@ bool llvm::isKnownNonNull(const Value *V, const TargetLibraryInfo *TLI) {
return !GV->hasExternalWeakLinkage();
if (ImmutableCallSite CS = V)
if (CS.paramHasAttr(0, Attribute::NonNull))
if (CS.isReturnNonNull())
return true;
// operator new never returns null.