summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/LazyValueInfo.cpp
diff options
context:
space:
mode:
authorIgor Laevsky <igmyrj@gmail.com>2015-09-18 13:01:48 +0000
committerIgor Laevsky <igmyrj@gmail.com>2015-09-18 13:01:48 +0000
commit0fa4819dd8d1bb0ec4aa7930eaebd97a4a52c744 (patch)
treee1f50601349f58cb122b9abff84fd2dbbef0fa8f /llvm/lib/Analysis/LazyValueInfo.cpp
parent84bc62f7a350ab9a513f5ee28e22ac4e34b1503d (diff)
downloadbcm5719-llvm-0fa4819dd8d1bb0ec4aa7930eaebd97a4a52c744.tar.gz
bcm5719-llvm-0fa4819dd8d1bb0ec4aa7930eaebd97a4a52c744.zip
[LazyValueInfo] Report nonnull range for nonnull pointers
Currently LazyValueInfo will report only alloca's as having nonnull range. For loads with !nonnull metadata it will bailout with no additional information. Same is true for calls returning nonnull pointers. This change extends LazyValueInfo to handle additional nonnull instructions. Differential Revision: http://reviews.llvm.org/D12932 llvm-svn: 247985
Diffstat (limited to 'llvm/lib/Analysis/LazyValueInfo.cpp')
-rw-r--r--llvm/lib/Analysis/LazyValueInfo.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp
index 7fc3e5afe48..795e3987c0d 100644
--- a/llvm/lib/Analysis/LazyValueInfo.cpp
+++ b/llvm/lib/Analysis/LazyValueInfo.cpp
@@ -531,8 +531,10 @@ bool LazyValueInfoCache::solveBlockValue(Value *Val, BasicBlock *BB) {
return true;
}
- if (AllocaInst *AI = dyn_cast<AllocaInst>(BBI)) {
- Res = LVILatticeVal::getNot(ConstantPointerNull::get(AI->getType()));
+ // If this value is a nonnull pointer, record it's range and bailout.
+ PointerType *PT = dyn_cast<PointerType>(BBI->getType());
+ if (PT && isKnownNonNull(BBI)) {
+ Res = LVILatticeVal::getNot(ConstantPointerNull::get(PT));
insertResult(Val, BB, Res);
return true;
}
OpenPOWER on IntegriCloud