[llvm] r320943 - Treat sret arguments as being dereferenceable in getPointerDereferenceableBytes()
Bjorn Steinbrink via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 17 07:11:52 PST 2017
Author: bsteinbr
Date: Sun Dec 17 07:11:52 2017
New Revision: 320943
URL: http://llvm.org/viewvc/llvm-project?rev=320943&view=rev
Log:
Treat sret arguments as being dereferenceable in getPointerDereferenceableBytes()
Modified:
llvm/trunk/lib/IR/Value.cpp
Modified: llvm/trunk/lib/IR/Value.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Value.cpp?rev=320943&r1=320942&r2=320943&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Value.cpp (original)
+++ llvm/trunk/lib/IR/Value.cpp Sun Dec 17 07:11:52 2017
@@ -627,9 +627,10 @@ uint64_t Value::getPointerDereferenceabl
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();
More information about the llvm-commits
mailing list