From 61797e329101dbbe1230a9b094f8cf71a770bf33 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 11 Jun 2009 17:54:56 +0000 Subject: Fix 4366: store to null in non-default addr space should not be turned into unreachable. llvm-svn: 73195 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Transforms/Scalar/InstructionCombining.cpp') 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(Ptr)) { + if (isa(Ptr) && + cast(Ptr->getType())->getAddressSpace() == 0) { if (!isa(Val)) { SI.setOperand(0, UndefValue::get(Val->getType())); if (Instruction *U = dyn_cast(Val)) -- cgit v1.2.3