summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/Loads.cpp
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2016-07-11 03:08:49 +0000
committerHal Finkel <hfinkel@anl.gov>2016-07-11 03:08:49 +0000
commitbf3957a553810f8cab2050b6d81707e43583d007 (patch)
tree72c2b7f570df1deeee15cd0e73f042a802fbf6cc /llvm/lib/Analysis/Loads.cpp
parente186debb8b08429bf075b14b645effaa7ca387a0 (diff)
downloadbcm5719-llvm-bf3957a553810f8cab2050b6d81707e43583d007.tar.gz
bcm5719-llvm-bf3957a553810f8cab2050b6d81707e43583d007.zip
Teach isDereferenceablePointer to look through returned-argument functions
For functions which are known to return their argument, isDereferenceableAndAlignedPointer can examine the argument value. Differential Revision: http://reviews.llvm.org/D9384 llvm-svn: 275038
Diffstat (limited to 'llvm/lib/Analysis/Loads.cpp')
-rw-r--r--llvm/lib/Analysis/Loads.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/Loads.cpp b/llvm/lib/Analysis/Loads.cpp
index 309a1d95efb..75426b54195 100644
--- a/llvm/lib/Analysis/Loads.cpp
+++ b/llvm/lib/Analysis/Loads.cpp
@@ -101,6 +101,11 @@ static bool isDereferenceableAndAlignedPointer(
return isDereferenceableAndAlignedPointer(ASC->getOperand(0), Align, Size,
DL, CtxI, DT, Visited);
+ if (auto CS = ImmutableCallSite(V))
+ if (const Value *RV = CS.getReturnedArgOperand())
+ return isDereferenceableAndAlignedPointer(RV, Align, Size, DL, CtxI, DT,
+ Visited);
+
// If we don't know, assume the worst.
return false;
}
OpenPOWER on IntegriCloud