summaryrefslogtreecommitdiff
path: root/lib/Analysis/LazyValueInfo.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2010-08-25 01:16:47 +0000
committerOwen Anderson <resistor@mac.com>2010-08-25 01:16:47 +0000
commit6cd207554994a6ad8577cdd1efd3ef3917bd547f (patch)
tree42d1a7b6db8f43df0fa83c771e993eded216601d /lib/Analysis/LazyValueInfo.cpp
parenta2c9188560eb9a7d494960fefd28cf0998d9a78f (diff)
downloadllvm-6cd207554994a6ad8577cdd1efd3ef3917bd547f.tar.gz
llvm-6cd207554994a6ad8577cdd1efd3ef3917bd547f.tar.bz2
llvm-6cd207554994a6ad8577cdd1efd3ef3917bd547f.tar.xz
In the default address space, any GEP off of null results in a trap value if you try to load it. Thus,
any load in the default address space that completes implies that the base value that it GEP'd from was not null. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112015 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/LazyValueInfo.cpp')
-rw-r--r--lib/Analysis/LazyValueInfo.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Analysis/LazyValueInfo.cpp b/lib/Analysis/LazyValueInfo.cpp
index e4cd867743..31ca2de283 100644
--- a/lib/Analysis/LazyValueInfo.cpp
+++ b/lib/Analysis/LazyValueInfo.cpp
@@ -457,10 +457,11 @@ LVILatticeVal LVIQuery::getBlockValue(BasicBlock *BB) {
// then we know that the pointer can't be NULL.
if (Val->getType()->isPointerTy()) {
const PointerType *PTy = cast<PointerType>(Val->getType());
- for (Value::use_iterator UI = Val->use_begin(), UE = Val->use_end();
- UI != UE; ++UI) {
- LoadInst *L = dyn_cast<LoadInst>(*UI);
- if (L && L->getParent() == BB && L->getPointerAddressSpace() == 0) {
+ for (BasicBlock::iterator BI = BB->begin(), BE = BB->end();BI != BE;++BI){
+ LoadInst *L = dyn_cast<LoadInst>(BI);
+ if (L && L->getPointerAddressSpace() == 0 &&
+ L->getPointerOperand()->getUnderlyingObject() ==
+ Val->getUnderlyingObject()) {
return LVILatticeVal::getNot(ConstantPointerNull::get(PTy));
}
}