diff options
author | Bjorn Steinbrink <bsteinbr@gmail.com> | 2017-12-19 08:46:46 +0000 |
---|---|---|
committer | Bjorn Steinbrink <bsteinbr@gmail.com> | 2017-12-19 08:46:46 +0000 |
commit | 2da4d9d86d1c043d122fbd00a4fab265c0cae85b (patch) | |
tree | 5afc2695059da04fc7949731b44445497988bf44 /llvm/lib | |
parent | e21475e54a377fe177ef5a5b4839f7107015133f (diff) | |
download | bcm5719-llvm-2da4d9d86d1c043d122fbd00a4fab265c0cae85b.tar.gz bcm5719-llvm-2da4d9d86d1c043d122fbd00a4fab265c0cae85b.zip |
Treat sret arguments as being dereferenceable in getPointerDereferenceableBytes()
Reviewers: rnk, hfinkel, efriedma
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D41355
llvm-svn: 321061
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/IR/Value.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp index eae697b2e4b..d36b7cd4c64 100644 --- a/llvm/lib/IR/Value.cpp +++ b/llvm/lib/IR/Value.cpp @@ -627,9 +627,10 @@ uint64_t Value::getPointerDereferenceableBytes(const DataLayout &DL, CanBeNull = false; if (const Argument *A = dyn_cast<Argument>(this)) { DerefBytes = A->getDereferenceableBytes(); - if (DerefBytes == 0 && A->hasByValAttr()) { + if (DerefBytes == 0 && (A->hasByValAttr() || A->hasStructRetAttr())) { Type *PT = cast<PointerType>(A->getType())->getElementType(); - DerefBytes = DL.getTypeStoreSize(PT); + if (PT->isSized()) + DerefBytes = DL.getTypeStoreSize(PT); } if (DerefBytes == 0) { DerefBytes = A->getDereferenceableOrNullBytes(); |