From 6cd207554994a6ad8577cdd1efd3ef3917bd547f Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Wed, 25 Aug 2010 01:16:47 +0000 Subject: 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 --- lib/Analysis/LazyValueInfo.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib') 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(Val->getType()); - for (Value::use_iterator UI = Val->use_begin(), UE = Val->use_end(); - UI != UE; ++UI) { - LoadInst *L = dyn_cast(*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(BI); + if (L && L->getPointerAddressSpace() == 0 && + L->getPointerOperand()->getUnderlyingObject() == + Val->getUnderlyingObject()) { return LVILatticeVal::getNot(ConstantPointerNull::get(PTy)); } } -- cgit v1.1