second half of fix for PR4366: don't zap store to null of

non-default addrspaces.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73253 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-06-12 21:01:07 +00:00
parent cd799b99cb
commit 69074a51f9

View File

@ -125,13 +125,17 @@ static bool MarkAliveBlocks(BasicBlock *BB,
}
}
if (StoreInst *SI = dyn_cast<StoreInst>(BBI))
if (isa<ConstantPointerNull>(SI->getOperand(1)) ||
isa<UndefValue>(SI->getOperand(1))) {
if (StoreInst *SI = dyn_cast<StoreInst>(BBI)) {
Value *Ptr = SI->getOperand(1);
if (isa<UndefValue>(Ptr) ||
(isa<ConstantPointerNull>(Ptr) &&
cast<PointerType>(Ptr->getType())->getAddressSpace() == 0)) {
ChangeToUnreachable(SI);
Changed = true;
break;
}
}
}
// Turn invokes that call 'nounwind' functions into ordinary calls.