aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
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
commit3590abfda093eb5b5e4536727d2e4195400b7716 (patch)
treedc0b86bf1e10543e076ac5b7fd931f2219641901 /lib/Transforms
parent6396329d52e21674093b71eee3327c03ae3fbeec (diff)
downloadexternal_llvm-3590abfda093eb5b5e4536727d2e4195400b7716.zip
external_llvm-3590abfda093eb5b5e4536727d2e4195400b7716.tar.gz
external_llvm-3590abfda093eb5b5e4536727d2e4195400b7716.tar.bz2
Fix 4366: store to null in non-default addr space should not be
turned into unreachable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73195 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 6d2ff0e..03a7317 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/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))