diff options
author | Owen Anderson <resistor@mac.com> | 2010-08-25 01:16:47 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2010-08-25 01:16:47 +0000 |
commit | 4afea9e3c66665079af4e597362a9261be58a0a4 (patch) | |
tree | b52e6d17757c400f1db456254ab7096cb6c0a122 /llvm/lib/Analysis/LazyValueInfo.cpp | |
parent | 9f077cbc13685a2408cfdca95c6ff55032e586de (diff) | |
download | bcm5719-llvm-4afea9e3c66665079af4e597362a9261be58a0a4.tar.gz bcm5719-llvm-4afea9e3c66665079af4e597362a9261be58a0a4.zip |
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.
llvm-svn: 112015
Diffstat (limited to 'llvm/lib/Analysis/LazyValueInfo.cpp')
-rw-r--r-- | llvm/lib/Analysis/LazyValueInfo.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp index e4cd867743a..31ca2de2836 100644 --- a/llvm/lib/Analysis/LazyValueInfo.cpp +++ b/llvm/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)); } } |