aboutsummaryrefslogtreecommitdiffstats
path: root/lib
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
parenta2c9188560eb9a7d494960fefd28cf0998d9a78f (diff)
downloadexternal_llvm-6cd207554994a6ad8577cdd1efd3ef3917bd547f.zip
external_llvm-6cd207554994a6ad8577cdd1efd3ef3917bd547f.tar.gz
external_llvm-6cd207554994a6ad8577cdd1efd3ef3917bd547f.tar.bz2
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')
-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 e4cd867..31ca2de 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));
}
}