From: Chris Lattner Date: Fri, 12 Jun 2009 21:01:07 +0000 (+0000) Subject: second half of fix for PR4366: don't zap store to null of X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=69074a51f90d7317b7923a47db45ec2689865895;p=oota-llvm.git 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 --- diff --git a/lib/Transforms/Scalar/SimplifyCFGPass.cpp b/lib/Transforms/Scalar/SimplifyCFGPass.cpp index b499279c696..5a85a047bec 100644 --- a/lib/Transforms/Scalar/SimplifyCFGPass.cpp +++ b/lib/Transforms/Scalar/SimplifyCFGPass.cpp @@ -125,13 +125,17 @@ static bool MarkAliveBlocks(BasicBlock *BB, } } - if (StoreInst *SI = dyn_cast(BBI)) - if (isa(SI->getOperand(1)) || - isa(SI->getOperand(1))) { + if (StoreInst *SI = dyn_cast(BBI)) { + Value *Ptr = SI->getOperand(1); + + if (isa(Ptr) || + (isa(Ptr) && + cast(Ptr->getType())->getAddressSpace() == 0)) { ChangeToUnreachable(SI); Changed = true; break; } + } } // Turn invokes that call 'nounwind' functions into ordinary calls.