diff options
author | Chris Lattner <sabre@nondot.org> | 2009-06-12 21:01:07 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-06-12 21:01:07 +0000 |
commit | 69074a51f90d7317b7923a47db45ec2689865895 (patch) | |
tree | ff80d63f7b1e173acdf7a86363635d5842ee1820 /lib/Transforms/Scalar/SimplifyCFGPass.cpp | |
parent | cd799b99cb4a4d7e8f7de59fd9c936812193c9b7 (diff) | |
download | llvm-69074a51f90d7317b7923a47db45ec2689865895.tar.gz llvm-69074a51f90d7317b7923a47db45ec2689865895.tar.bz2 llvm-69074a51f90d7317b7923a47db45ec2689865895.tar.xz |
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
Diffstat (limited to 'lib/Transforms/Scalar/SimplifyCFGPass.cpp')
-rw-r--r-- | lib/Transforms/Scalar/SimplifyCFGPass.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/SimplifyCFGPass.cpp b/lib/Transforms/Scalar/SimplifyCFGPass.cpp index b499279c69..5a85a047be 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<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. |