summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-06-11 17:54:56 +0000
committerChris Lattner <sabre@nondot.org>2009-06-11 17:54:56 +0000
commit61797e329101dbbe1230a9b094f8cf71a770bf33 (patch)
tree02950bec2a96449a331d5d2ac4dff5cf3c83ceb3 /llvm/lib/Transforms/Scalar/InstructionCombining.cpp
parent5dce37298f49f76b9514df81b9d7e56b56b1fe18 (diff)
downloadbcm5719-llvm-61797e329101dbbe1230a9b094f8cf71a770bf33.tar.gz
bcm5719-llvm-61797e329101dbbe1230a9b094f8cf71a770bf33.zip
Fix 4366: store to null in non-default addr space should not be
turned into unreachable. llvm-svn: 73195
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 6d2ff0e3e53..03a7317138a 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -11824,7 +11824,8 @@ Instruction *InstCombiner::visitStoreInst(StoreInst &SI) {
if (SI.isVolatile()) return 0; // Don't hack volatile stores.
// store X, null -> turns into 'unreachable' in SimplifyCFG
- if (isa<ConstantPointerNull>(Ptr)) {
+ if (isa<ConstantPointerNull>(Ptr) &&
+ cast<PointerType>(Ptr->getType())->getAddressSpace() == 0) {
if (!isa<UndefValue>(Val)) {
SI.setOperand(0, UndefValue::get(Val->getType()));
if (Instruction *U = dyn_cast<Instruction>(Val))
OpenPOWER on IntegriCloud